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

