#include<stdio.h>
#define MAX_HEAP_SIZE 250
int heap[MAX_HEAP_SIZE + 1];

int hsize = 0;

int parent(int id);

int left(int id);

int right(int id);

int main(){
  int n;

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

  for(int i = 1; i <= n; i++){
    printf("node %d: key = %d, ", i, heap[i]);
    if(parent(i) > 0){
      printf("parent key = %d, ", heap[parent(i)]);
    }
    if(left(i) <= hsize){
      printf("left key = %d, ", heap[left(i)]);
    }
    if(right(i) <= hsize){
      printf("right key = %d, ", heap[right(i)]);
    }
    printf("\n");
  }
  return 0;
}

int parent(int id){

  return id/2;
}

int left(int id){
  return 2*id;
}

int right(int id){
  return 2*id + 1;
}

