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

int main(void) {
	int i, n;
	long *heap = NULL;
	
	scanf("%d", &n);
	
	heap = (long*)malloc(sizeof(long) * (n + 1));
	
	for (i = 1; i <= n; i++) {
		scanf("%ld", &heap[i]);
	}
	
	for (i = 1; i <= n; i++) {
		printf("node %d: key = %ld, ", i, heap[i]);
		if (i != 1) {
			printf("parent key = %ld, ", heap[i / 2]);
		}
		if (i * 2 <= n) {
			printf("left key = %ld, ", heap[i * 2]);
		}
		if (i * 2 + 1 <= n) {
			printf("right key = %ld, ", heap[i * 2 + 1]);
		}
		printf("\n");
	}
	
	return 0;
}



/*
1
23
4567
89101112
*/