#include <stdio.h>

int main(){
  int a[251], i, n;

  scanf("%d",&n);

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

  printf("node %d: key = %d, left key = %d, right key = %d, \n",1,a[1],a[2],a[3]);
  for(i=2; i<n+1; i++){
    if(i*2<n)
      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(i*2==n)
      printf("node %d: key = %d, parent key = %d, left key = %d, \n",i,a[i],a[i/2],a[2*i]);

    else
      printf("node %d: key = %d, parent key = %d, \n",i,a[i],a[i/2]);

  }
  return 0;
}

