#include<stdio.h>

int main(){
  int H,i;
  scanf("%d",&H);
  int id[H+1];
  id[0]=0;
  for(i=1;i<=H;i++){
    scanf("%d",&id[i]);
  }

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

  return 0;
}

