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


  return 0;
}

