#include<stdio.h>

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

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

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

int main(){
  int A, i, B[100000 + 1];

  scanf("%d",&A);

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

  for(i = 1; i <= A; i++){
    printf("node %d: key = %d, ",i, B[i]);
    if(p(i) >= 1)printf("parent key = %d, ",B[p(i)]);
    if(l(i) <= A)printf("left key = %d, ",B[l(i)]);
    if(r(i) <= A)printf("right key = %d, ",B[r(i)]);

    printf("\n");
  }

  return 0;
}

