#include <stdio.h>
#define MAX 250

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

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

int parent(int i){
  return i/2;
}


int heap[MAX];


main(){
  int i, size;

  scanf("%d", &size);

  size = size + 1;

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

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

    printf("\n");

  }

  return 0;

}