#include <stdio.h>
int parent(int);
int left(int);
int right(int);
int main(){
  int n,i,T[250];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&T[i+1]);
  }
  for(i=1;i<=n;i++){
    printf("node %d: key = %d,",i,T[i]);
    if(i != 1) printf(" parent key = %d,",T[parent(i)]);
    if(left(i) <= n) printf(" left key = %d,",T[left(i)]);
    if(right(i) <= n) printf(" right key = %d,",T[right(i)]);
    printf("\n");
  }
  return 0;
}

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

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

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