#include<stdio.h>

int main(){
  int i,n;
  int D[1000000];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&D[i]);
  }
  for(i=0;i<n;i++){
    printf("node %d: key = %d, ",i,D[i]);
    if(i/2>=1){
      printf("parent key = %d, ",D[i/2]);
    }
    if(i*2<=n){
      printf("left key = %d, ",D[i*2]);
    }
    if(i*2+1<=n){
      printf("right key = %d, ",D[i*2+1]);
    }
    printf("\n");
  }
}

