#include <stdio.h>
#define N 1000000

int main()
{
  int i,n,data[N+1];
  int p,l,r;

  scanf("%d",&n);

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

  for(i=1; i<=n; i++){
    printf("node %d: key = %d, ",i,data[i]);

    p = i/2;
    l = i*2;
    r = i*2+1;

    if(p >= 1)
      printf("parent key = %d, ",data[p]);

    if(l <= n)
      printf("left key = %d, ",data[l]);

    if(r <= n)
      printf("right key = %d, ",data[r]);

    printf("\n");
  }

  return 0;
}
