#include<stdio.h>
#include<stdlib.h>

int main(){
  int i, n;
  int *N;

  scanf("%d", &n);

  N = (int *)malloc(sizeof(int) * (n + 1));

  for(i = 1; i <= n; i++){
    scanf("%d", &N[i]);
  }

  for(i = 1; i <= n; i++){
    printf("node %d: key = %d, ", i, N[i]);

    if(i != 1) printf("parent key = %d, ", N[i / 2]);

    if(2 * i + 1 <= n) printf("left key = %d, right key = %d, ", N[2 * i], N[2 * i + 1]);

    else if(2 * i <= n) printf("left key = %d, ", N[2 * i]);

    printf("\n");
  }

  return 0;
}