#include <stdio.h>

int parent(int index){
	return index / 2;
}

int heapleft(int index){
	return index * 2;
}

int heapright(int index){
	return index * 2 + 1;
}

int main(void)
{
	int i ,n;
	int node[250];

	//??????????????????H
	scanf("%d", &n);

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

	//??????
	for (i = 1; i <= n; i++)
	{
		printf("node %d: key = %d, ", i, node[i]);
		if (i != 1)
		{
			printf("parent key = %d, ", node[parent(i)]);
		}
		if (n >= heapleft(i) )
		{
			printf("left key = %d, ", node[heapleft(i)]);
		}
		if (n >= heapright(i) )
		{
			printf("right key = %d, ", node[heapright(i)]);
		}
		printf("\n");
	}

	return 0;
}