#include<stdio.h>

int main(void){
	int n;
	int h[251];
	int i;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&(h[i]));
	}
	for(i=1;i<=n;i++){
		printf("node %d: key = %d, ",i,h[i]);
		if(i>=2){
			printf("parent key = %d, ",h[i/2]);
		}
		if(i*2<=n){
			printf("left key = %d, ",h[i*2]);
		}
		if(i*2+1<=n){
			printf("right key = %d, ",h[i*2+1]);
		}
		printf("\n");
	}
	return 0;
}