#include<stdio.h>
#define max 250
int main(){
int n, i;
int H[max];
int pk, lk, rk;//parent key, left key, right key

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

for(i = 1; i <= n; i++){
	printf("node %d: ", i);
	printf("key = %d, ", H[i]);
	
	pk = i/2;
	lk = 2*i;
	rk = 2*i + 1;
	
	if(i > 1){
		printf("parent key = %d, ", H[pk]);
	}
	if(lk <= n){
		printf("left key = %d, ", H[lk]);
	}
	if(rk <= n){
		printf("right key = %d, ", H[rk]);
	}
	printf("\n");

}
return 0;
}