#include <stdio.h>

void value(int *, int, int *);
int main(){
  int i;
  int A[250], n;
  scanf("%d", &n);
  for(i=1;i<=n;i++) scanf("%d", &A[i]);
  
  for(i=1;i<=n;i++) value(A, i, &A[i]);

  return 0;
}

void value(int *p, int j, int *q){
  /*value and index */
 
  printf("node %d: key = %d,", j, *q);
  if(j != 1)printf(" parent key = %d,", p[j/2] );
  if(p[2*j] != '\0')printf(" left key = %d,", p[2*j] );
  if(p[2*j+1] != '\0')printf(" right key = %d,", p[2*j+1] );
  printf("\n");
}

