#include<stdio.h>
int p(int a){
    return a/2;
}
 
int left(int a){
    return 2*a;
}
 
int right(int a){
    return (2*a)+1;
}

int main(){
  int x[2000000],y,i,j,n;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&x[i]);
  }
  for(i=1;i<=n;i++){
    printf("node %d: key = %d,",i,x[i]);
    if(p(i)>=1){
      printf(" parent key = %d,",x[p(i)]);
    }
    if(left(i)<=n){
      printf(" left key = %d,",x[left(i)]);
    }
    if(right(i)<=n){
      printf(" right key = %d,",x[right(i)]);
    }
    if(i==n)break;
    printf("\n");
  }
    return 0;
}

