#include <stdio.h>

#define MAX 250

int main() {
	int n, i, parent, left, right;
	int A[MAX + 1];

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

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

	return 0;
}
