#include <stdio.h>
#define MAX 250
int main(){
  int howm,i,j,par,le,ri;
  int T[MAX];
  scanf("%d",&howm);
  for(i=1;i<=howm;i++){
    scanf("%d",&T[i]);
  }
  for(i=1;i<=howm;i++){
    printf("node %d: key = %d,",i,T[i]);
    if(i/2>=1){
      par=i/2;
      printf(" parent key = %d,",T[par]);
    }
    if(howm>=i*2){
      le=i*2;
      printf(" left key = %d,",T[le]);
    }
    if(howm>=i*2+1){
      ri=i*2+1;
      printf(" right key = %d,",T[ri]);
    }
    printf(" \n");
  }
  return 0;
}

