#define MAX 250
 
int main(){
  int h,i,a[MAX];
 
  scanf("%d" ,&h);
  for(i = 0 ; i < h ; i++){
    scanf("%d" , &a[i]);
  }
 
  for(i = 0 ; i < h ; i++){
    printf("node %d: key = %d, " ,i+1 ,a[i]);
 
    if(i){
      printf("parent key = %d, " ,a[(i+1)/2-1]);
    }
 
   
    if(2*i+1 < =h){
      printf("right key = %d, " ,a[2*i+2]);
    }
 if(2*i <= h){
      printf("left key = %d, " ,a[2*i+1]);
    }
    printf("\n");
  }
 
  return 0;
}