#include<stdio.h>

int main()
{
  int H,i;
  int tree[250];

  scanf("%d",&H);

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

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

  return 0;
}
      

