#include<stdio.h>

#define N 200000

/*typedef struct node {
  int pa;
  int left;
  int right;
  int key;
} Tree;
*/
int pa(int x) {return x/2;}
int le(int x) {return x*2;}
int ri(int x) {return x*2+1;}

int main()
{
  int H,i,n[N];
  
  
  scanf("%d",&H);

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

  for(i=1; i<=H; i++)
    {
      printf("node %d: key = %d, ",i,n[i]);

      if(pa(i) >= 1) printf("parent key = %d, ",n[pa(i)]);

      if(le(i) <= H) printf("left key = %d, ",n[le(i)]);

      if(ri(i) <= H) printf("right key = %d, ",n[ri(i)]);

      printf("\n");
    }

  return 0;
}

  
	   


