#include<stdio.h>
#define MAX_NUMBER_OF_NODE 250

/*struct Node
{
  int id;
  int index_of_node;
}
*/

//struct Node node[MAX_NUMBER_OF_NODE];
int insert(int);
int main()
{
  int node[MAX_NUMBER_OF_NODE];
  int number_of_node;//it is represented as H in AOJ
  int i,id;

  //for(i = 0 ; i < MAX_NUMBER_OF_NODE ;i++ )node[i].index_of_node = NULL;
   

  scanf("%d",&number_of_node);
  for(i = 1 ; i <= number_of_node ; i++)
    {
      scanf("%d",&id);
      node[i] = id;
    }


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

/*
void insert(int id);
{



}
*/

