#include<stdio.h>
int k[251];

int Parent(int i){
  return k[i/2];
}

int Left(int i){
  if(i*2>=251)
    return -(1<<29);
  return k[2*i];
}

int Right(int i){
  if(i*2>=251)
    return -(1<<29);
  return k[2*i+1];
}

main(){

  int size,i;
  for(i=0;i<251;i++)
    k[i]=-(1<<29);


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

  for(i=1;i<=size;i++){
    printf("node %d: key = %d, ", i, k[i]);
    if(Parent(i)!=-(1<<29))
      printf("parent key = %d, ", Parent(i));
    if(Left(i)!=-(1<<29))
      printf("left key = %d, ", Left(i));
    if(Right(i)!=-(1<<29))
      printf("right key = %d, ", Right(i));
    printf("\n");
    }

  return 0;

}