// AOJ ALDS1_9_A Complete Binary Tree
// 2018.5.1 bal4u

#include <stdio.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in()
{
	int n = 0, c = gc();
	if (c == '-') { c = gc();
		do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

#define QSIZE     300
#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

int que[QSIZE+5];

int main()
{
	int H, i, t;

	H = in();
	for (i = 1; i <= H; i++) que[i] = in();
	for (i = 1; i <= H; i++) {
		printf("node %d: key = %d, ", i, que[i]);

		t = PARENT(i);
		if (t > 0 && t <= H) printf("parent key = %d, ", que[t]);

		t = LEFT(i);
		if (t > 0 && t <= H) printf("left key = %d, ", que[t]);

		t = RIGHT(i);
		if (t > 0 && t <= H) printf("right key = %d, ", que[t]);

		putchar('\n');
	}
	return 0;
}
