#include<iostream>
#include<algorithm>
using namespace std;
const int N=1e5;
int a[N];
int head=1,tail=1;
struct Tree{
int father;
int date;
int lson=-1;
int rson=-1;
}tree[N];
int build(int x,int y){
if(tail%2==0){
tree[tail].date=y;
tree[tail].father=head;
tree[head].lson=x;
tail++;return 0;
}
if(tail%2==1){
tree[tail].date =y;
tree[tail].father =head;
tree[head].rson =x;
tail++;
head++;
}
}
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
}tree[1].date =a[1];tail++;
for(int i=2;i<=n;i++){
build(i,a[i]);
}
for(int i=1;i<=n;i++){
cout<<tree[i].date<<"-"<<tree[i].lson<<"-"<<tree[i].rson<< "\n";
}
}