#include <stdio.h>

int heap[255];

int parent(int i) {
    return i/2;
}

int left(int i) {
    return 2*i;
}

int right(int i) {
    return 2*i+1;
}


int main(void) {
	int i, n, t;
	scanf("%d\n", &n);
	
	for(i=1;i<=n;i++) {
		scanf("%d", &heap[i]);
	}

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

