#include<stdio.h>
#define N 250

typedef struct{

  int id,k,pk,lk,rk;

} Node;

Node node[N];


int main()
{

  int i,n;

  scanf("%d",&n);

  for(i=1;i<=n;i++)
    scanf("%d",&node[i].k);

  for(i=1;i<=n;i++)
    {
      printf("node %d: key = %d, ",i,node[i].k);
      if(i != 1)
	{
	  node[i].pk = node[i/2].k;
	  printf("parent key = %d, ",node[i].pk);
	}
      if(2*i <= n)
	{
	  node[i].lk = node[2*i].k;
	  printf("left key = %d, ",node[i].lk);
	}

      if(2 * i + 1 <= n)
	{
	  node[i].rk = node[2*i+1].k;
	  printf("right key = %d, ",node[i].rk);
	}
      printf("\n");
    }
  
  return 0;
}

