#include <stdio.h>

typedef struct{
  int key;
  int pk;
  int l;
  int r;
} Node;

Node A[255];
int n;

void info(void)
{
  int i;
  for(i=1;i<n+1;i++)
    {
      if(i==1){
	A[i].pk=-1;
	A[i].l=A[2*i].key;
	A[i].r=A[2*i+1].key;
      }
      else{
	A[i].pk=A[i/2].key;
	
	if(n >= 2*i){
	  A[i].l=A[2*i].key;
	  A[i].r=A[2*i+1].key;
	}
      }
    }
}

int main()
{
  int i;

  scanf("%d",&n);
  for(i=1;i<n+1;i++)
    {
      scanf("%d",&A[i].key);
    }

  info();
 
  for(i=1;i<n+1;i++)
    {
      
      if(i==1) 
	printf("node %d: key = %d, left key = %d, right key = %d,",i,A[i].key,
	       A[i].l,A[i].r);
      else if(n>=2*i+1)
	printf("node %d: key = %d, parent key = %d, left key = %d, right key = %d,",i
	       ,A[i].key,A[i].pk,A[i].l,A[i].r);
      else if(n>=2*i)
	printf("node %d: key = %d, parent key = %d, left key = %d,",i
	       ,A[i].key,A[i].pk,A[i].l);
      else
	printf("node %d: key = %d, parent key = %d,",i,A[i].key,A[i].pk);

      printf(" \n");
    }

  return 0;
}

