//complete Binary tree


#include<stdio.h>
#define N NULL
#define MAX 250

int main()
{
  int i,n,arr[MAX];


  //input data
  scanf("%d",&n);
  for(i = 1; i< n+1; i++)
    {
      scanf("%d",&arr[i]);
    }

  //output data
  for(i = 1; i < n+1; i++)
    {
      printf("node %d: ",i);

      printf("key = %d, ",arr[i]);

      if(i != 1)
	{
	  printf("parent key = %d, ",arr[i/2]);
	}
      if(2*i <= n)
	{
	  printf("left key = %d, ",arr[2*i]);
	}
      if(2*i+1 <= n)
	{
	  printf("right key = %d, ",arr[2*i+1]);
	}
      printf("\n");
    }


  return 0;
}


