#include <stdio.h>

int main() {
  int i, n, k, A[251];

  for(i = 0;i < 251;i++)
    A[i] = 2000000001;

  scanf("%d", &n);
  for(i = 1;i < n + 1;i++)
    scanf("%d", &A[i]);

  for(i = 1;i < n + 1;i++) {
    printf("node %d: key = %d, ", i, A[i]);
    if(i != 1)
      printf("parent key = %d, ", A[i / 2]);

    if(i < n / 2) {
      if(A[i * 2] != 2000000001)
        printf("left key = %d, ", A[i * 2]);

      if(A[i * 2 + 1] != 2000000001)
        printf("right key = %d, ", A[i * 2 + 1]);
    }

    printf("\n");
  }

  return 0;
}

