#include<stdio.h>
#define H 250

int main(){
  int num,i,node[H];

  scanf("%d",&num);

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

  for(i=1; i<=num; i++){
    printf("node %d: key = %d, ",i ,node[i]);
    if(i!=1) printf("parent key = %d, ",node[i/2]);
    if(i*2<=num) printf("left key = %d, ",node[2*i]);
    if(i*2+1<=num)printf("right key = %d, ",node[2*i+1]);
    printf("\n");
  }
  return 0;
}