#include <stdio.h>
#define N 251


typedef struct{
  int key, lk, rk, pk;
}Node;

void Insert(int);

Node node[N];
int size;
	    
int main () {
  int n = 0, i, m = 0;


  scanf("%d",&n);


  for(i = 1 ; i <= n ; i++) {
    scanf("%d",&m);
    Insert(m);
  }


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

    if(i != 1) {
      printf("parent key = %d, ",node[node[i].pk].key);
    }

    if(2 * i <= n) printf("left key = %d, ",node[node[i].lk].key);
    if(2 * i + 1 <= n) printf("right key = %d, ",node[node[i].rk].key);

    printf("\n");
  }


  return 0;
}


void Insert(int n) {
  int i;

  size++;

  node[size].key = n;
  node[size].lk = size * 2;
  node[size].rk = size * 2 + 1;
  node[size].pk = size / 2;
}


