#include <stdio.h>

#define MAXH 251

int main()
{
  int i, H;
  int T[MAXH];

  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 != 1) printf("parent key = %d, ", T[i/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;
}


