#include <stdio.h>

int main(void){
  int n,i,right,left,parent;
  int heap[251];

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


  for( i = 1 ; i < n + 1 ; i++ ){
    parent = i/2;
    left = i*2;
    right = (2*i)+1;

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