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

int main(void){
	int size;
	int *A;
	int i;

	scanf("%d",&size);

	A=(int*)malloc(sizeof(int)*(size+1));

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

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

	return 0;
}