#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int list[251];
int main() {
	int size, i, j;
	scanf("%d", &size);

	//scanning
	for (i = 1; i <= size; i++) {
		scanf("%d ", &list[i]);
	}

	//printing
	for(i = 1; i <= size; i++) {
		printf("node %d: key = %d, ", i, list[i]);
		j = i / 2;
		if (j >= 1)printf("parent key = %d, ", list[j]);
		if (2 * i <= size)printf("left key = %d, ", list[i * 2]);
		if (2 * i + 1 <= size)printf("right key = %d, ", list[i * 2 + 1]);
		printf("\n");
	}

	return 0;
}
