
#include<stdio.h>
#include<stdlib.h>
int main(){
  int *T;
  int i,x;
  scanf("%d",&x);

  T= (int *)malloc(sizeof(int)*x+1);

  for(i=1;i<x+1;i++){
    scanf("%d",&T[i]);
  }
  
for(i=1;i<x+1;i++){
  printf("node %d: key =%d,",i,T[i]);

  if(i/2>=1) printf(" parent key = %d,",T[i/2]);

  if(i*2<=x) printf(" left key = %d,",T[i*2]);

  if(i*2+1<=x+1)  printf(" right key = %d,",T[i*2+1]);
  
  printf ("\n");
			    }

 return 0;
}