#include <stdio.h>
#define MAX 250
int main(){
  int i,n;
  int heap[MAX];
  for(i = 0;i<MAX;i++){
    heap[i]=0;
  }
  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, left key = %d, right key = %d, \n",i,heap[i],heap[2*i],heap[2*i+1]);
    }
    else if(heap[2*i] != 0 && heap[2*i+1]!=0 && 2*i+1<MAX ){
      printf("node %d: key = %d, parent key = %d, left key = %d, right key = %d, \n",i,heap[i],heap[i/2],heap[2*i],heap[2*i+1]);
    }
    else if(heap[2*i] != 0  && 2*i+1<MAX){
       printf("node %d: key = %d, parent key = %d, left key = %d, \n",i,heap[i],heap[i/2],heap[2*i]);
    }
    else if(heap[2*i+1] != 0 && 2*i+1<MAX) {
       printf("node %d: key = %d, parent key = %d, left key = %d, \n",i,heap[i],heap[i/2],heap[2*i+1]);
    }
    else {
      printf("node %d: key = %d, parent key = %d, \n",i,heap[i],heap[i/2]);
}
  }
  return 0;
}

