#include<stdio.h>
#define MAX 100000

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

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

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

int main(){
 int i;
 int n;
 int id[MAX];

 scanf("%d", &n);/*回数*/

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

 //出力 (output)
 for(i=1; i<=n; i++) {
 	printf("node %d: key = %d, ",i,id[i]);
 	if(i > 1) printf("parent key = %d, ",id[parent_key(i)]);
 	if(left_key(i) <= n) printf("left key = %d, ",id[left_key(i)]);
 	if(right_key(i) <= n) printf("right key = %d, ",id[right_key(i)]);
 	printf("\n");
 }
 return 0;
}
