#include<stdio.h>
#define NI NTL
#define H 250

int parent(int);
int Left(int);
int Right(int);

int main(){
  int n,i,p,left,right;
  int P[H];
  scanf("%d", &n);
  for(i = 1;i<=n;i++){
    scanf("%d" , &P[i]);
  }
  for(i = 1;i<=n;i++){
    printf("node %d: key = %d, ",i,P[i]);
    p = parent(i);
  if(p!=0){
    printf("parent key = %d, ", P[p]);
  }
  left = Left(i);
  if(left <= n){
    printf("left key = %d, ", P[left]);
}
  right = Right(i);
    if(right <= n){
      printf("right key = %d, ",P[right]);
    }
    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;
}