#include<stdio.h>
#define MAX 800
#define MIN -2000000001


int main(){
int H[MAX];
int i,n;

for(i=0;i<MAX;i++)H[i]=MIN;


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

for(i=1;i<=n;i++){

 printf("node %d: key = %d, ",i,H[i]);
 
 if(H[i/2]!=MIN)printf("parent key = %d, ",H[i/2]);

 if(H[2*i]!=MIN)printf("left key = %d, ",H[2*i]);

 if(H[2*i+1]!=MIN)printf("right key = %d, ",H[2*i+1]);

 printf("\n");

}

return 0;
}
