#include<stdio.h>
int main(void){
  int id[251];
  int k,pk,lk,rk;
  int i,N;

  scanf("%d",&N);
  for(i=1;i<=N;i++){
    scanf("%d",&id[i]);
  }

  for(i=1;i<=N;i++){
    k=id[i];
    pk=id[i/2];
    lk=id[2*i];
    rk=id[2*i+1];
    printf("node %d: key = %d, ",i,k);
    if(i/2 > 0){
      printf("parent key = %d, ",pk);
    }
    if(2*i <= N){
      printf("left key = %d, ",lk);
    }
    if(2*i+1 <= N){
      printf("right key = %d,",rk);
    }
    printf("\n");
  }
  return 0;
}