#include <stdio.h>

#define MAX 250

int Parent(int);
int Left(int);
int Right(int);

int main(){
  int i, n;
  int left, right;
  int key[MAX];

  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]);

    left = Left(i);
    right = Right(i);

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

    printf("\n");
  }
}

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

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

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