#include<stdio.h>


struct Node
{
  int key;
  int left;
  int right;
  int parent;
};

struct Node a[251];

int main()
{
  int n,i;
  
  scanf("%d",&n);

  for(i = 1 ; i <= n ; i++)
    {
      scanf("%d",&a[i].key);
    }
  for(i = 1 ; i <= n ; i++)
    {
      
      if(i * 2 <= n)
	{
         a[i].left = a[i*2].key;
	 if(i*2 + 1 <= n)
	   {
            a[i].right = a[(i*2) + 1].key;
	   }
	}
      if(i >= 2)a[i].parent = a[i/2].key;
    }

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

  return 0;
}

