#include <stdio.h>

int parent(int);
int left(int);
int right(int);

int main(){
  int i, n;
  int key[250];

  scanf("%d",&n);

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

  for(i=1;i<=n;i++){

    printf("node = %d: key = %d, ", i, key[i]);

    if(i != 1) printf("parent key = %d, ", key[parent(i)]);
    if(left(i) <= n) printf("left key = %d, ", key[left(i)]);
    if(right(i) <= n) printf("right key = %d, ", key[right(i)]);

    printf("\n");
  }
}

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

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

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