#include<stdio.h>

int main(){
	long long int x[300];
	int limit;
	
	scanf("%d",&limit);
	
	for(int i=1;i<=limit;i++) {
		scanf("%d", &x[i]);
	}

	for(int i=1;i<=limit;i++){
	printf("node %d: key = %d, ",i,x[i]);
	if(i/2>0)
		printf("parent key = %d, ",x[i/2]);
	if(i*2<=limit)
		printf("left key = %d, ",x[i*2]);
	if(i*2+1<=limit)
		printf("right key = %d, ",x[i*2+1]);
	printf("\n");
}

return 0;
}
