//2020.1.16
//s1270188 xxxmk2
//alds1_09a

#include<stdio.h>

#define N 250

int main(){
  int i , data[N+1], num;

  //input
  scanf("%d",&num);
  for(i=1;i<=num;i++) scanf("%d",&data[i]);

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

