#include<stdio.h>
#define N 250

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

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

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

main(){
  
  int i, n, H[N];
  
  scanf("%d",&n);
  for(i=1; i<n+1; i++){
    scanf("%d",&H[i]);
  }
  
  for(i=1; i<n+1; i++){
	printf("node %d: key = %d, ",i, H[i]);
	if(parent(i) > 0) printf("parent key = %d, ",H[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;
}