#include<stdio.h>
#define N 251

int parent(int i){
  return i/2;

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

}

int right(int i){
  return 2*i+1;

}

int main(){
  int heap[N];
  int i,n;
  scanf("%d",&n);
  for(i=1;i<=n;i++)scanf("%d",&heap[i]);
  for(i=1;i<=n;i++){

    if(i==1){
      printf("node %d: key = %d, ",i,heap[i]);
      if(left(i)<=n)printf("left key = %d, ",heap[left(i)]);
      if(right(i)<=n)printf("right key = %d, ",heap[right(i)]);
}
    else {
      printf("node %d: key = %d, parent key = %d, ",i,heap[i],heap[parent(i)]);
      if(left(i)<=n)printf("left key = %d, ",heap[left(i)]);
      if(right(i)<=n)printf("right key = %d, ",heap[right(i)]);

}
    printf("\n");





  }
  return 0;
}