#include<stdio.h>
#define M 100000

int main(){
  int num,i;
  int d[M+1];
  scanf("%d",&num);

  for(i=1;i<=num;i++){
    scanf("%d",&d[i]);
  }

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

