#include <stdio.h>
#define MAX 10000

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

int main(){
  int i,h,tmp,array[MAX+1];
  
  scanf("%d",&h);
  
  for(i=1;i<=h;i++){

    scanf("%d",&array[i]);
  }
  
  for(i=1;i<=h;i++){
    printf("node %d: key = %d, ",i,array[i]);
    tmp = parent(i);
    if(tmp>=1) printf("parent key = %d, ",array[tmp]);
    tmp = left(i);
    if(tmp<=h) printf("left key = %d, ",array[tmp]);
    tmp = right(i);
    if(tmp<=h) printf("right key = %d, ",array[tmp]);

    printf("\n");
  }

  return 0;
}


    
      
      
      
    

