#include <stdio.h>

typedef struct heap{
  int key;
  int pkey;
  int lkey;
  int rkey;
}Heap;

int main(){
  int i, nm;
  Heap heap[250];
  
  scanf("%d", &nm);
  for(i = 1; i <= nm; i++){
    scanf("%d", &heap[i].key);
    heap[2*i].pkey = heap[i].key;
    heap[2*i+1].pkey = heap[i].key;
  }

  for(i = 1; i <= nm; i++){
    if(nm >= (2*i+1)){
      heap[i].lkey = heap[2*i].key;
      heap[i].rkey = heap[2*i+1].key;
    }
    else if(nm == 2*i) heap[i].lkey = heap[2*i].key;
  }

  for(i = 1; i <= nm; i++){
    if(i == 1){
      printf("node %d: key = %d, ", i, heap[i].key);
    }
    else{
      printf("node %d: key = %d, parent key = %d, ", i, heap[i].key, heap[i].pkey);
    }
    if(nm >= (2*i+1)){
      printf("left key = %d, right key = %d, ", heap[i].lkey, heap[i].rkey);
    }
    else if(nm == 2*i) printf("left key = %d, ", heap[i].lkey);
    printf("\n");
  }

  
  return 0;
}
