#include<stdio.h>

#define MAX 250
#define NIL -2000000000

int key[MAX];
int pk(int k),rk(int k),lk(int k);

int main(void){
  int i,n,H;
  scanf("%d",&n);

  for(i=0;i<MAX;i++){
    key[i]=NIL;
  }

  for(i=0;i<n;i++){
    scanf("%d",&H);
    key[i]=H;
  }
  for(i=0;i<n;i++){
    printf("node %d: key = %d, ",i+1,key[i]);
    if(key[pk(i)]!=NIL&&i!=0)
      printf("parent key = %d, ",key[pk(i)]);
    if(MAX>lk(i)&&key[lk(i)]!=NIL)
      printf("left key = %d, ",key[lk(i)]);
    if(MAX>rk(i)&&key[rk(i)]!=NIL)
      printf("right key = %d, ",key[rk(i)]);

    printf("\n");
  }
  return 0;
}

int pk(int k){
  return (k-1)/2;
}

int rk(int k){
  return 2*k+2;
}

int lk(int k){
  return 2*k+1;
}

