#include <stdio.h>
#define H 250;


struct Node{
  int key;
  struct Node right,left,parent;
};



int main(){
  int i,n,A[H],id;

  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }



 for(i=1;i<=n;i++){
   A[i].right=right(i);
   A[i].left=left(i);
   A[i].parent=parent(i);
 }

 for(i=1;i<=n;i++){
   id=i;
   printf("node %d: key = %d, parent key = %d, left key = %d, right key = %d \n",id,A[i],parent.A[i],left.A[i],right.A[i]);

 }

 return 0;
}


  Node parent(struct int i){
     if(i<=1) return " ";
    return floor(i/2);
    
  }
  
  Node left(struct int i){
    return 2*i;
  }
  
  Node right(struct int i){
    return (2*i)+1;
    
  }
  