#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#define MAX 300
int getparent(int i)
{
	return i/2;
}
int getleft(int i)
{
	return 2*i;
}
int getright(int i)
{
	return 2*i+1;
}
int main()
{
	int h,i,heap[MAX];	
	scanf("%d",&h);
	for(i=1;i<=h;i++)
		scanf("%d",&heap[i]);
	for(i=1;i<=h;i++)
	{
		printf("node %d: key = %d, ",i,heap[i]);
		if(getparent(i)>=1)
			printf("parent key = %d, ",heap[getparent(i)]);
		if(getleft(i)<=h)
			printf("left key = %d, ",heap[getleft(i)]);
		if(getright(i)<=h)
			printf("right key = %d, ",heap[getright(i)]);
		printf("\n");
	}
	return 0;
}
