#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include <limits.h>


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

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

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

int main(){
	int A[251];
	int n,i;
	
	for (i = 0; i < 250; i++){
		A[i]= INT_MAX;
	}

	scanf("%d",&n);
	for (i = 1; i <= n; i++){
		scanf("%d",&A[i]);
	}
	for (i = 1; i <= n; i++){
		printf("node %d: key = %d,",i,A[i]);
		if (parent(i) > 0){
			printf(" parent key = %d,",A[parent(i)]);
		}
		if (left(i) < 250 && A[left(i)] != INT_MAX){
			printf(" left key = %d,",A[left(i)]);
			if (right(i)<250 && A[right(i)] != INT_MAX){
				printf(" right key = %d,",A[right(i)]);
			}
		}
		puts("");
	}

	return 0;
}