#include<stdio.h>

#define MAX 250

int main(){
  int A[MAX];
  int heap_size,i;

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