#include<stdio.h>
#define MAX 250

int Parent(int i){
  return i/2;
};
int Left(int i){
  return 2*i;
};
int Right(int i){
  return 2*i+1;
};
int main(){
  int i, n;
  int left, right, parent;
  int H[MAX];

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

  for(i=0;i<n;i++){
    left = Left(i+1);
    right = Right(i+1);
    parent = Parent(i+1);

    printf("node %d: key = %d, ",i+1,H[i]);
    if(i!=0){
      printf("parent key = %d, ",H[parent-1]);
    }
    if(left<=n){
      printf("left key = %d, ",H[left-1]);
    }
    if(right<=n){
      printf("right key = %d, ",H[right-1]);
    }
    printf("\n");
  }
  
  return 0;
}