#include <stdio.h>
int main(void) {
	int heap[251], heap_size, i;

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