#include <stdio.h>

int main()
{
  int id,k,pk,lk,rk,A[250],i;


  scanf("%d",&id);

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


  for(i=1;i<=id;i++){

    printf("node %d: key = %d, ",i,A[i]);

    if(id == 1) printf("left key = %d, right key = %d",A[2*i],A[2*i+1]);
    
    if((i / 2) >= 1 ) printf("parent key = %d, ",A[i/2]);

    if(2*i <= id) printf("left key = %d, ",A[2*i]);

    if((2*i + 1) <= id ) printf("right key = %d, ",A[2*i + 1]);

    printf("\n");  
}





  return 0;
}