#include<stdio.h>

#define N 250

int main(){
  int Heap[N];
  int loop,judge;
  int i;

  scanf("%d",&loop);

  judge=loop;
  
  for(i=1;i<loop+1;i++){
    scanf(" %d",&Heap[i]);
  }

  for(i=1;i<loop+1;i++){
    printf("node %d: key = %d, ",i,Heap[i]);

    if((i/2)>=1){
      printf("parent key = %d, ",Heap[(i/2)]);
    }

    if(judge>=(2*i)){
      printf("left key = %d, ",Heap[(2*i)]);
    }

    if(judge>=(2*i)+1){
      printf("right key = %d, ",Heap[(2*i)+1]);
    }

    printf("\n");
    
  }

  return 0;
}

