#include <stdio.h>
#include <stdlib.h>

int main(){
  int A[251];
  int H, i, j;
  
  scanf("%d",&H);
  if(H < 0 || 250 < H) exit(1);

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

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

  return 0;
}

      
    
    
  

