#include<stdio.h>
#define H 250
#define K 2000000000

main(){
  int h,A[H];
  int i;

  scanf("%d",&h);

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

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

  return 0;
}

