#include <stdio.h>
struct Tree{
  int k;
  int pk;
  int lk;
  int rk;
};
 
int main(){
 
  int H,i;
  struct Tree A[251];
  scanf("%d",&H);
 
  for(i=1;i<=H;i++){
  scanf("%d",&A[i].k);
  }
 
   for(i=1;i<=H;i++){
    if(i/2 >0)    A[i].pk=A[i/2].k;
    else A[i].pk=NULL;
 
    if(2*i !=0){
      A[i].lk=A[2*i].k;
      A[i].rk=A[2*i+1].k;
    }
    else {
      A[i].lk=-1;
      A[i].rk=-1;
    }
 
  }
   
  for(i=1;i<=H;i++){
    printf("node %d: key = %d, ",i,A[i].k);
    
    if(A[i].pk!=NULL)  printf("parent key = %d, ",A[i].pk);
 
    if(A[i].lk!=NULL)    printf("left key = %d, ",A[i].lk);
 
    if(A[i].rk!=NULL)    printf("right key = %d, ",A[i].rk);
     
    printf("\n");
  }
 
 
  return 0;
}