#include <stdio.h>
int parent(int i)
{
  return i/2;
}
int left(int i)
{
  return 2*i;
}
int right(int i)
{
  return 2*i+1;
}

int key[251];

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

