#include<stdio.h>
#define N 250

int parent(int);
int left(int);
int right(int);


int main(){
  
  int A[N],id,H;
  scanf("%d",&H);
  for(id=1;id<=H;id++){
    scanf("%d",&A[id]);
  }
  
  for(id=1;id<=H;id++){
    printf("node %d: key = %d, ",id,A[id]);
    if(id>1)
      printf("parent key = %d, ",A[parent(id)]);
    if(left(id)<=H)
      printf("left key = %d, ",A[left(id)]);
    if(right(id)<=H)
      printf("right key = %d, ",A[right(id)]);
    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;
}