#include<stdio.h>
#define MAX 252

int main(){
  int datanum,i,heaptree[MAX];
  scanf("%d",&datanum);
  for(i=1;i<=datanum;i++){
    scanf("%d",&heaptree[i]);
  }
    for(i=1;i<=datanum;i++){
      printf("node %d: key = %d, ",i,heaptree[i]);
      if(i != 1)printf("parent key = %d, ",heaptree[i/2]);
      if(datanum >= i * 2)printf("left key = %d, ",heaptree[i*2]);
      if(datanum >= i * 2 + 1)printf("right key = %d, ",heaptree[i*2+1]);
      printf("\n");
    }
  return 0;
}


