#include <stdio.h>

main(){
  int i,d=0,s=1,s,data[251];
scanf("%d",&s);
for(i=1;i<=s;i++)
scanf("%d",&s);
for(i=1;i<=s;i++){
printf("node %d: key = %d, ",i,data[i]);
if(i/2)
printf("parent key = %d, ",data[i/2]);
if(2*i<=s)
printf("left key = %d, ",data[2*i]);
if(2*i+1<=s)
printf("right key = %d, ",data[2*i+1]);
print("\n");
}

return 0;
}
