#include <bits/stdc++.h>
using namespace std;
const int Nmax = 1e6;
int n;
int a[Nmax],p[Nmax];
bool check(){
for(int i=0;i<n-1;i++){
if(a[i+1]-a[i]!=p[i]) return false;
}
return true;
}
int main()
{
cin>>n;
for(int i=0;i<n-1;i++){
cin>>p[i];
a[i]=i+1;
}
a[n-1]=n;
int flag=0;
do{
if(check()==true) {
flag=1;
break;
}
}while(next_permutation(a,a+n));
if(flag){
for(int i=0;i<n;i++){
cout<<a[i]<<" ";
}
cout<<endl;
}
else cout<<-1<<endl;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpjb25zdCBpbnQgTm1heCA9IDFlNjsKCmludCBuOwppbnQgYVtObWF4XSxwW05tYXhdOwoKYm9vbCBjaGVjaygpewoJZm9yKGludCBpPTA7aTxuLTE7aSsrKXsKCQlpZihhW2krMV0tYVtpXSE9cFtpXSkgcmV0dXJuIGZhbHNlOwoJfQoJcmV0dXJuIHRydWU7Cn0KCmludCBtYWluKCkKewoJY2luPj5uOwoJZm9yKGludCBpPTA7aTxuLTE7aSsrKXsKCQljaW4+PnBbaV07CgkJYVtpXT1pKzE7Cgl9CglhW24tMV09bjsKCWludCBmbGFnPTA7Cglkb3sKCQlpZihjaGVjaygpPT10cnVlKSB7CgkJCWZsYWc9MTsKCQkJYnJlYWs7CgkJfQoJfXdoaWxlKG5leHRfcGVybXV0YXRpb24oYSxhK24pKTsKCWlmKGZsYWcpewoJCWZvcihpbnQgaT0wO2k8bjtpKyspewoJCQljb3V0PDxhW2ldPDwiICI7CgkJfQoJCWNvdXQ8PGVuZGw7Cgl9CgllbHNlIGNvdXQ8PC0xPDxlbmRsOwoJcmV0dXJuIDA7Cn0=