#include<stdio.h>

int heap[300];

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

int main(void)
{
	int i,N,re;
	scanf("%d",&N);

	for(i=1;i<=N;i++)
	{
		scanf("%d",&heap[i]);
	}
	for(i=1;i<=N;i++)
	{
		printf("node %d: key = %d, ",i,heap[i]);
		if(i!=1)
		{
			printf("parent key = %d, ",heap[parent(i)]);
		}
		re=left(i);
		if(re<=N)
		{
			printf("left key = %d, ",heap[re]);
		}
		re=right(i);
		if(re<=N)
		{
			printf("right key = %d, ",heap[re]);
		}
		printf("\n");
	}


	return 0;
}

