#include<stdio.h>

int Le(int);
int Ri(int);

int oya(int x){
  return x / 2;
}



int main(){
  int n,i,A[100001];

  scanf("%d",&n);

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

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

    if(oya(i) >= 1) printf("parent key = %d, ",A[oya(i)]);
    if(Le(i) <= n) printf("left key = %d, ",A[Le(i)]);
    if(Ri(i) <= n) printf("right key = %d, ",A[Ri(i)]);

    printf("\n");
  }

  return 0;
}



int Le(int x){
  return 2 * x;
}

int Ri(int x){
  return 2 * x + 1;
}

