include <stdio.h>
#define N 250
 
int Parent(int);
int LeftC(int);
int RightC(int);
 
int main(){
  int n,i;
  int num[N];
 
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&num[i]);
  }
  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,num[i]);
    if(Parent(i)>=1) printf("parent key = %d, ",num[Parent(i)]);
    if(n>=LeftC(i)) printf("left key = %d, ",num[LeftC(i)]);
    if(n>=RightC(i)) printf("right key = %d, ",num[RightC(i)]);
    printf("\n");
  }
  return 0;
}
 
int Parent(int i){
  return i/2;
}
 
int LeftC(int i){
  return 2*i;
}
 
int RightC(int i){
  return 2*i+1;
}