#include <stdio.h>

int main(void){
	int A[251] = {0};
	int H;
	int id, k, pk, lk, rk;
	int i;

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

	for (id = 1; id <= H; id++){
		printf("node %d: ", id);

		k = A[id];
		printf("key = %d, ", k);

		if (id != 1){
			pk = A[id / 2];
			printf("parent key = %d, ", pk);
		}

		if (2 * id <= H){
			lk = A[2 * id];
			printf("left key = %d, ", lk);
		}

		if (2 * id + 1 <= H){
			rk = A[2 * id + 1];
			printf("right key = %d, ", rk);
		}

		printf("\n");
	}

	return 0;
}