#include <stdio.h>
#define MAX_N 250

int N;
int heap[MAX_N];

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