#include <stdio.h>

main(){
  int i,b,c, A[251];

  scanf("%d", &c);

  for(i = 1; i <= c; i++) scanf("%d", &A[i]);

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

