#include<stdio.h>
#include<stdlib.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 heap[MAX],id,n,left,right;
   
  scanf("%d",&n);
  for(id=1 ; id<=n; id++){
    scanf("%d",&heap[id]);
  }
 
  for(id=1 ; id<=n ; id++){
    printf("node %d: key = %d, ",id,heap[id]);
    if(id>=2) printf("parent key = %d, ",heap[Parent(id)]);
 
    left = Left(id);
    right = Right(id);
    if(left<=n) printf("left key = %d, ",heap[left]);
    if(right<=n) printf("right key = %d, ",heap[right]);
 
    printf("\n");
  }
  return 0;
}