#include <stdio.h>
int main(void){
  int Array[251],heapsize,i;
  scanf("%d",&heapsize);
  for(i=1;i<=heapsize;i++)
    scanf("%d",&Array[i]);

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

  return 0;
}

