#include<stdio.h>

int main()
{
  int i = 0;
  int x = 0;
int heap[250];

  scanf("%d",&x);
  for(i=1;i<=x;i++)
    {
      scanf("%d",&heap[i]);
    }

  for(i=1;i<=x;i++)
    {
      if(i==1)
	{
	  printf("node %d: key = %d, ",i,heap[i]);
	}
      else
	{
	  printf("node %d: key = %d, parent key = %d, ",i,heap[i],heap[i/2]);
	}
      if(2*i<=x)
	{
	  printf("left key = %d, ",heap[2*i]);
	}
      if(2*i+1<=x)
	{
	  printf("right key = %d, ",heap[2*i+1]);
	}
      printf("\n");
    }
return 0;
}