#include<stdio.h>

#define M 10000

int p(int c){
  return c/2;
}

int l(int c){
  return c*2;
}

int r(int c){
  return c*2 + 1;
}

int main(){
  int i;
  int n;
  int H[M],pk,lk,rk;

  scanf("%d",&n);

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

  for(i=1; i<=n; i++){
    printf("node %d: key = %d, ",i,H[i]);
    pk = p(i);
    lk = l(i);
    rk = r(i);
    if (pk >= 1) printf("parent key = %d, ",H[pk]);
    if (lk <= n) printf("left key = %d, ",H[lk]);
    if (rk <= n) printf("right key = %d, ",H[rk]);
    printf("\n");
  }
  
  return 0;
}

