#include <stdio.h>
#define N 250

main(){
  int i, n, H[N];
  scanf("%d",&n);
  for(i=1;i<n+1;i++){
    scanf("%d",&H[i]);
  }
  for(i=1;i<n+1;i++){
    if(i==1) {
      printf("node %d: key = %d, ", i, H[i]);
    }
    else 
      printf("node %d: key = %d, parent key = %d, ", i, H[i], H[parent(i)]);
    if(left(i) <= n){
      printf("left key = %d, ", H[left(i)]);
    }
    if(right(i) <= n){
      printf("right key = %d", H[right(i)]);
    }
    printf("\n");
  }
   
  return 0;   
}

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

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

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