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

