#include <stdio.h>

int n;

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

  printNode(A);
  return 0;
}

