#include<stdio.h>
#define M 251

int main()
{
  int i,H,T[M];
  
  scanf("%d",&H);

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

    printf("node %d: key = %d, ",i,T[i]);
    if((i-i%2) > 0)
      printf("parent key = %d, ",T[(i-i%2)/2]);
    if(i*2 <= H)
      printf("left key = %d, ",T[i*2]);
    if(i*2+1 <= H)
      printf("right key = %d, ",T[i*2+1]);
    printf("\n");
  }
  return 0;
}
    
    
  

