#include<stdio.h>
#define M 250
int pa(int);
int left(int);
int right(int);
int main(){
  int s[M+1],i,H;
  scanf("%d",&H);
  for(i=1;i<=H;i++){
    scanf("%d",&s[i]);
  }
  for(i=1;i<=H;i++){
    printf("node %d: key = %d, ",i,s[i]);
    if (pa(i) >= 1)printf("parent key = %d, ", s[pa(i)]);
    if (left(i) <= H)printf("left key = %d, ", s[left(i)]);
    if (right(i) <= H)printf("right key = %d, ", s[right(i)]);
    printf("\n");
  }
  return 0;
}
int pa(int i){
  return i/2;
}
int left(int i){
  return 2*i;
}
int right(int i){
  return 2*i+1;
}

