#include<stdio.h>
#define MAX 100000
main(){
  int p, i;
  int M[MAX+1];
  scanf("%d", &p);
  for ( i = 1; i <= p; i++ ) scanf("%d", &M[i]);

  for (i=1;i<=p;i++) {
    printf("node %d: key = %d, ",i,M[i]);
    if (i/2>=1)printf("parent key = %d, ", M[i/2]);
    if (i*2<=p) printf("left key = %d, ", M[i*2]);
    if (i*2+1<=p) printf("right key = %d, ", M[i*2+1]);
    printf("\n");
  }
  
  return 0;
}

