#include<stdio.h>
#define NIL -1

 int p(int i){return i/2;}
 int l(int i){return i*2;}
 int r(int i){return i*2+1;}

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

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