#include <stdio.h>
#include <stdlib.h>

#define H 250

int main(){
  
  int h,i,l,r,p;
  int A[H+1];
    scanf("%d",&h);

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

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

