/*
 * a.c
 *
 *  Created on: 2014/06/27
 *      Author: nana
 */


#include<stdio.h>

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

int main(){

	int i,heapSize;;
	int a[250];

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

	for(i=1;i<=heapSize;i++){
		printf("node %d: key = %d, ",i,a[i]);
		if(parent(i)!=0){
			printf("parent key = %d, ",a[parent(i)]);
		}
		if(left(i)<=heapSize){
			printf("left key = %d, ",a[left(i)]);
		}
		if(right(i)<=heapSize){
			printf("right key = %d, ",a[right(i)]);
		}
		printf("\n");
	}

	return 0;
}