#include<stdio.h>

int parent(int);
int left(int);
int right(int);

int main(){
	int n,i,a[100005];

	scanf("%d",&n);

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

	for(i = 0; i < n ; i++){
		printf("node %d: key = %d, ",i+1,a[i+1]);

		if(parent(i+1) >= 1)printf("parent key = %d, ",a[parent(i+1)]);
		if(left(i+1) <= n)printf("left key = %d, ",a[left(i+1)]);
		if(right(i+1) <= n)printf("right key = %d, ",a[right(i+1)]);
		printf("\n");
	}
	return 0;
}

int parent(int z){
	return z / 2;
}
int left(int z){
	return z * 2;
}
int right(int z){
	return z * 2 +1;
}

