#include<stdio.h>
#define M 100000

int p(int i){return i/2;}
int l(int i){return i*2;}
int r(int i){return i*2 +1;}

int main()
{
  int N,i,S[M+1];

  scanf("%d",&N);

  for(i=1;i<=N;i++)
  {
    scanf("%d",&S[i]);
  }
  for(i=1;i<=N;i++)
  {
    printf("node %d: key = %d, ",i,S[i]);
    if(p(i)>=1)printf("parent key = %d, ",S[p(i)]);
    if(l(i)<=N)printf("left key = %d, ",S[l(i)]);
    if(r(i)<=N)printf("right key = %d, ",S[r(i)]);
    printf("\n");
  }
  return 0;
}