#include <stdio.h>
int parent(int a){
  return a/2;
}

int right(int a){
  return (2*a)+1;
}

int left(int a){
  return 2*a;
}

int main(){
  int i,hai[250],n,H;
  scanf("%d",&n);

  for(i=1;i <= n;i++){
    scanf("%d",&hai[i]);
  }
 
    for(i=1;i<=n;i++){
  printf("node %d: key = %d,",i,hai[i]);
  if(1 <=parent(i) ){
    printf(" parent key = %d,",hai[parent(i)]);
  }
  if(left(i) <= n){
    printf(" left key = %d,",hai[left(i)]);
  }
  if(right(i) <= n){
    printf(" right key = %d,",hai[right(i)]);
  }
  printf("\n");
  }
  
  return 0;
}

