#include<stdio.h>

int main()
{
int i,j,k,A[250];
scanf("%d",&n);

A[0]=2000000000;


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(A[i/2]!=2000000000)
{
printf("parent key = %d, ",A[i/2]);
}

if(i*2<=n&&A[i*2]!=2000000000)
{
printf("left key = %d, "A[i*2]);
}


if((i*2+1)<=n&&A[i*2+1]!=2000000000)
{
printf("right key = %d, ",A[i*2+1]);
}
printf("\n");
}
return 0;



}


}