#include <stdio.h>
#define H 250

int main()
{
  int i,A[H],n;
  int pk,lk,rk;

  scanf("%d",&n);

  for(i=0;i<n;i++) scanf("%d",&A[i]);
  
  for(i=1;i<=n;i++){
    pk = i/2;
    lk = i*2;
    rk = lk + 1;
    printf("node %d: key = %d, ",i,A[i-1]);

    if(pk == 0); 

    else printf("parent key = %d, ",A[pk-1]);

    if(lk > n) printf("\n");

    else if(lk == n) printf("left key = %d, \n",A[lk-1]);

    else printf("left key = %d, right key = %d, \n",A[lk-1],A[rk-1]);
  }

  return 0;
}
  

  

