#include <stdio.h>

main(){
  int i, d = 0, s = 1, n, data[251];
  scanf("%d", &n);
  for(i=1;i<=n;i++) scanf("%d", &data[i]);
  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ", i, data[i]);
    if(i/2) printf("parent key = %d, ", data[i/2]);
    if(2*i<=n) printf("left key = %d, ", data[2*i]);
    if(2*i+1<=n) printf("right key = %d, ", data[2*i+1]);
    printf("\n");
  }
  return 0;
}