#include <stdio.h>
#define H 250
int main(){
  int i,n;
  int N[H];

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

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

