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

int left(int i){
  return A[(2 * i)+1];
}
int right(int i){
  return A[(2 * i + 1)+1];
}
int parent(int i){
  if(i%2 == 1)return A[i/2];
  else return A[i/2-1];
}

