#include <stdio.h>
#define MAX 10000

int leftkey(int i) {
  return 2*i;
}
int rightkey(int i) {
  return 2*i+1;
}
int parentkey(int i) {
  return i/2;
}


int main() {
  int h;
  int A[MAX+1], i, n;
  scanf("%d", &h);
  for(i=1;i<=h;i++) {
    scanf("%d", &A[i]);
  }

  for(i=1;i<=h;i++) {
    printf("node %d: key = %d, ", i, A[i]);
    if(parentkey(i) > 0) {
      printf("parent key = %d, ", A[parentkey(i)]);
    }
    if (leftkey(i) <= h) {
      printf("left key = %d, ", A[leftkey(i)]);
    }
    if (rightkey(i) <= h) {
      printf("right key = %d, ", A[rightkey(i)]);
    }
    printf("\n");
  }

}