#include <stdio.h>
#define MAX 10000

int Parent(int i){
  return i/2;
}

int Left(int i){
  return 2*i;
}

int Right(int i){
  return 2*i+1;
} 

main(){

  int n, j,k,u[MAX], p, l, r;
  scanf ("%d", &n);

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

  for(k=1;k<=n;k++){
    printf("node %d: key = %d, ", k, u[k]);
    p = Parent(k);
    l = Left(k);
    r = Right(k);

    if(p >= 1){
      printf("parent key = %d, ", u[p]);
    }

    if(l <= n){
      printf("left key = %d, ", u[l]);
    }

    if(r <= n){
      printf("right key = %d, ", u[r]);
    }
    printf("\n");
  }
  return 0;
}