  #include<stdio.h>
  #define MAX 100000
  int parent(int i){
    return i/2;
  }
  int left(int i){
    return 2*i;
  }
  int right(int i){
    return 2*i+1;
  }
  int main(){
    int H,k,A[MAX+1];
    scanf("%d",&H);
    for(k=1;k<=H;k++){
      scanf("%d",&A[k]);
    }
    for(k=1;k<=H;k++){
      printf("node %d: key = %d, ",k,A[k]);
      if(parent(k)>=1)printf("parent key = %d, ",A[parent(k)]);
      if(left(k)<=H)printf("left key = %d, ",A[left(k)]);
      if(right(k)<=H)printf("right key = %d, ",A[right(k)]);
      printf("\n");
    }
    return 0;
  }

