#include<stdio.h>
#define N 250

int Pa(int);
int Le(int);
int Ri(int);


int main(){

 
  int i,num,A[N],le,ri;

 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[Pa(i)]);

    le=Le(i);
    ri=Ri(i);

    if(le<=num)printf(" left key = %d,",A[Le(i)]);
    if(ri<=num)printf(" right key = %d,",A[Ri(i)]);
    puts("");
  }
  


  return 0;
}
  int Pa(int i){
    return i/2;
  }

  int Le(int i){
    return 2*i;
  }


  int Ri(int i){
    return 2*i+1;
  }