#include<stdio.h>

#define MAX 100000


int p(int i) {
  return i/2;
}

int l(int i){
  return 2*i;
}

int r(int i){
  return 2*i+1;
}




int main(){
  int T,i,b,arry[MAX+1];
  int w,e,o;
 
  
  scanf("%d",&T);

  for(i=1;i<=T;i++){
    scanf("%d",&arry[i]);
  }

  for(i=1;i<=T;i++){
    printf("node %d: key = %d, ",i,arry[i]);
    if(p(i)>=1) printf("parent key = %d, ",arry[w=p(i)]);
    if(l(i)<=T) printf("left key = %d, ",arry[e=l(i)]);
    if(r(i)<=T) printf("right key = %d, ",arry[o=r(i)]);
    printf("\n");
  }

  return 0;
}
                  

