#include <stdio.h>

#define index_max 250

int main(){
  int i;
  int n,a[index_max];
  int left_search,right_search;

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

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

    if(i){
      printf("parent key = %d, " ,a[(i+1)/2-1]);
    }
    left_search=2*i+1;
    if(left_search < n){
      printf("left key = %d, " ,a[2*i+1]);
    }
    right_search=2*i+2;
    if(right_search < n){
      printf("right key = %d, " ,a[2*i+2]);
    }
    printf("\n");
  }

  return 0;
}

