#include <stdio.h>
#include <stdlib.h>

int main()
{
  int H,i,p,l,r;
  int *A;

  scanf("%d",&H);
  A=(int *)malloc(sizeof(int)*H+1);


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

  for(i=1;i<H+1;i++)
    {
      p=i/2;
      l=2*i;
      r=2*i+1;

      printf("node %d: key = %d, ",i,A[i]);
      if(p!=0) printf("parent key = %d, ",A[p]);
      if(l<H+1 && r>H) printf("left key = %d, \n",A[l]);
      else if(l<H+1) printf("left key = %d, ",A[l]);
      else printf("\n");
      if(r<H+1 && l<H+1) printf("right key = %d, \n",A[r]);

      
    }
  

  return 0;
}

