#include<stdio.h>
 
int p(int num) { 
  return num / 2; 
}
int l(int num) { 
  return 2 * num; 
}
int r(int num) { 
  return 2 * num+1; 
}
 
int main() {
  int hum, i, array[251];
 
  scanf("%d", &hum);
    for (i = 1; i < hum + 1; i++) scanf("%d", &array[i]);
     
    for (i = 1; i < hum + 1; i++) {

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

    if (p(i) >= 1) printf("parent key = %d, ", array[p(i)]);

    if (l(i) <= hum) printf("left key = %d, ", array[l(i)]);

    if (r(i) <= hum) printf("right key = %d, ", array[r(i)]);
  
  printf("\n");

    }
    return 0;
}