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