#include <stdio.h>

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


}
  return 0;
}