#include<stdio.h>

int heap[260];

int main() {
	int N;

	scanf("%d", &N);
	for (int i = 1; i <= N; i++) {
		scanf("%d", &heap[i]);
	}

	for (int i = 1; i <= N; i++) {
		printf("node %d: key = %d, ", i, heap[i]);
		if (i / 2 > 0)printf("parent key = %d, ", heap[i / 2]);
		if (2 * i <= N)printf("left key = %d, ", heap[2 * i]);
		if (2 * i + 1 <= N)printf("right key = %d, ", heap[2 * i + 1]);
		printf("\n");
	}

	return 0;
}
