#include<stdio.h>
#define N 250

int parent(i){
  return i/2;
}

 int left(i){
   return 2*i;
 }

 int right(i){
   return 2*i+1;
 }

main(){

  int i, n, H[N];

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

  for(i=0; i<n; i++){
	printf("node %d: key = %d,",i, H[i]);
	if(parent(i) > 0) printf("parent key = %d, ",A[parent(i)]);
	if(left(i) <= n)printf("left key = %d, ",H[left(i)]);
	if(right(i) <= n)printf("right key = %d, ",H[right(i)]);

	printf("\n");
  }
  return 0;
}