/* A Heap */
#include <stdio.h>
int main(){
  int heap_size;
  int pk,lk,rk;
  int i;

  scanf("%d",&heap_size);
  int A[heap_size+1];

  /* scan A[1...heap_size] */
  for(i=1;i<=heap_size;i++){
    scanf("%d",&A[i]);
  }

  /* print */
  for(i=1;i<=heap_size;i++){
    if(i>1)printf("\n");
    printf("node %d: ",i);

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

    pk=i/2;
    if(pk>0)printf("parent key = %d, ",A[pk]);

    lk=2*i;
    if(lk<=heap_size)printf("left key = %d, ",A[lk]);
    else continue;    /* If left key doesn't exist, right key doesn't exist too. */

    rk=2*i+1;
    if(rk<=heap_size)printf("right key = %d,",A[rk]);
  }
  printf("\n");
  return 0;
}