#include <stdio.h>

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

}

