#include <stdio.h>

int main(){
  int H,A[250],i,pk,lk,rk;
   
  scanf("%d",&H);
  for(i=1;i<=H;i++){
    scanf("%d",&A[i]);
  }

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

