#include <stdio.h>
int main(){
  int n,H[251],p,l,r,i;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&H[i]);
  }

 for(i=1;i<=n;i++){  
   p=i/2;
   l=2*i;
   r=2*i+1; 
   printf("node %d: key = %d,",i,H[i]);
   if(i!=1) printf("parent key = %d,",H[p]);
   if(i*2<=n) printf("left key = %d,",H[l]);
   if(i*2+1<=n) printf("right key = %d,",H[r]);
   printf("\n");
 }
 return 0;
}