#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int grand(int x) { return uniform_int_distribution<int>(0, x - 1)(rng); }
long long getInt() {
  bool minus = false;
  long long result = 0;
  char ch;
  ch = getchar();
  while (true) {
    if (ch == '-') break;
    if (ch >= '0' && ch <= '9') break;
    ch = getchar();
  }
  if (ch == '-')
    minus = true;
  else
    result = ch - '0';
  while (true) {
    ch = getchar();
    if (ch < '0' || ch > '9') break;
    result = result * 10 + (ch - '0');
  }
  if (minus)
    return -result;
  else
    return result;
}
long long gcd(long long x, long long y) {
  if (x < y) return gcd(y, x);
  if (y == 0) return x;
  return gcd(y, x % y);
}
const long long mod = 1e9 + 7;
long long modexp(long long x, long long ex) {
  long long ans = 1ll;
  while (ex > 0) {
    if (ex & 1ll) ans = (ans * x) % mod;
    ex >>= 1ll;
    x = (x * x) % mod;
  }
  return ans;
}
const long long maxn = 1e6 + 7;
const long long N = 1e6 + 7;
const long long inf = 1e151515151515151515151515151515 + 7;
long long srr[N];
long long per[N];
pair<long long, long long> tree[N];
long long lzy[N];
void build(long long nd, long long st, long long en) {
  if (st == en) {
    tree[nd] = {srr[st], -st};
    return;
  }
  long long mid = (st + en) >> 1;
  build(nd + nd, st, mid);
  build(nd + nd + 1, mid + 1, en);
  tree[nd] = min(tree[nd + nd], tree[nd + nd + 1]);
}
inline void push(long long x) {
  if (lzy[x] == 0) return;
  tree[x + x].first += lzy[x];
  tree[x + x + 1].first += lzy[x];
  lzy[x + x] += lzy[x];
  lzy[x + x + 1] += lzy[x];
  lzy[x] = 0;
}
void upd(long long nd, long long st, long long en, long long l, long long r,
         long long val) {
  if (en < l || r < st) return;
  if (l <= st && en <= r) {
    tree[nd].first += val;
    lzy[nd] += val;
    return;
  }
  push(nd);
  long long mid = (st + en) >> 1;
  upd(nd + nd, st, mid, l, r, val);
  upd(nd + nd + 1, mid + 1, en, l, r, val);
  tree[nd] = min(tree[nd + nd], tree[nd + nd + 1]);
}
pair<long long, long long> qry(long long nd, long long st, long long en,
                               long long l, long long r) {
  if (en < l || r < st) return {inf, 0};
  if (l <= st && en <= r) return tree[nd];
  push(nd);
  long long mid = (st + en) >> 1;
  return min(qry(nd + nd, st, mid, l, r), qry(nd + nd + 1, mid + 1, en, l, r));
}
int32_t main() {
  {
    ios ::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  };
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> srr[i];
  }
  build(1, 1, n);
  for (long long i = 1; i <= n; i++) {
    auto p = qry(1, 1, n, 1, n);
    per[-p.second] = i;
    upd(1, 1, n, -p.second + 1, n, -i);
    upd(1, 1, n, -p.second, -p.second, inf);
  }
  for (long long i = 1; i <= n; i++) {
    cout << per[i] << " ";
  }
  cout << "\n";
}

### Prompt

Construct a Cpp code solution to the problem outlined:

An array of integers p_{1},p_{2}, …,p_{n} is called a permutation if it contains each number from 1 to n exactly once. For example, the following arrays are permutations: [3,1,2], [1], [1,2,3,4,5] and [4,3,1,2]. The following arrays are not permutations: [2], [1,1], [2,3,4].

There is a hidden permutation of length n.

For each index i, you are given s_{i}, which equals to the sum of all p_{j} such that j < i and p_{j} < p_{i}. In other words, s_i is the sum of elements before the i-th element that are smaller than the i-th element.

Your task is to restore the permutation.

Input

The first line contains a single integer n (1 ≤ n ≤ 2 ⋅ 10^{5}) — the size of the permutation.

The second line contains n integers s_{1}, s_{2}, …, s_{n} (0 ≤ s_{i} ≤ (n(n-1))/(2)).

It is guaranteed that the array s corresponds to a valid permutation of length n.

Output

Print n integers p_{1}, p_{2}, …, p_{n} — the elements of the restored permutation. We can show that the answer is always unique.

Examples

Input


3
0 0 0


Output


3 2 1


Input


2
0 1


Output


1 2


Input


5
0 1 1 1 10


Output


1 4 3 2 5

Note

In the first example for each i there is no index j satisfying both conditions, hence s_i are always 0.

In the second example for i = 2 it happens that j = 1 satisfies the conditions, so s_2 = p_1.

In the third example for i = 2, 3, 4 only j = 1 satisfies the conditions, so s_2 = s_3 = s_4 = 1. For i = 5 all j = 1, 2, 3, 4 are possible, so s_5 = p_1 + p_2 + p_3 + p_4 = 10.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int grand(int x) { return uniform_int_distribution<int>(0, x - 1)(rng); }
long long getInt() {
  bool minus = false;
  long long result = 0;
  char ch;
  ch = getchar();
  while (true) {
    if (ch == '-') break;
    if (ch >= '0' && ch <= '9') break;
    ch = getchar();
  }
  if (ch == '-')
    minus = true;
  else
    result = ch - '0';
  while (true) {
    ch = getchar();
    if (ch < '0' || ch > '9') break;
    result = result * 10 + (ch - '0');
  }
  if (minus)
    return -result;
  else
    return result;
}
long long gcd(long long x, long long y) {
  if (x < y) return gcd(y, x);
  if (y == 0) return x;
  return gcd(y, x % y);
}
const long long mod = 1e9 + 7;
long long modexp(long long x, long long ex) {
  long long ans = 1ll;
  while (ex > 0) {
    if (ex & 1ll) ans = (ans * x) % mod;
    ex >>= 1ll;
    x = (x * x) % mod;
  }
  return ans;
}
const long long maxn = 1e6 + 7;
const long long N = 1e6 + 7;
const long long inf = 1e151515151515151515151515151515 + 7;
long long srr[N];
long long per[N];
pair<long long, long long> tree[N];
long long lzy[N];
void build(long long nd, long long st, long long en) {
  if (st == en) {
    tree[nd] = {srr[st], -st};
    return;
  }
  long long mid = (st + en) >> 1;
  build(nd + nd, st, mid);
  build(nd + nd + 1, mid + 1, en);
  tree[nd] = min(tree[nd + nd], tree[nd + nd + 1]);
}
inline void push(long long x) {
  if (lzy[x] == 0) return;
  tree[x + x].first += lzy[x];
  tree[x + x + 1].first += lzy[x];
  lzy[x + x] += lzy[x];
  lzy[x + x + 1] += lzy[x];
  lzy[x] = 0;
}
void upd(long long nd, long long st, long long en, long long l, long long r,
         long long val) {
  if (en < l || r < st) return;
  if (l <= st && en <= r) {
    tree[nd].first += val;
    lzy[nd] += val;
    return;
  }
  push(nd);
  long long mid = (st + en) >> 1;
  upd(nd + nd, st, mid, l, r, val);
  upd(nd + nd + 1, mid + 1, en, l, r, val);
  tree[nd] = min(tree[nd + nd], tree[nd + nd + 1]);
}
pair<long long, long long> qry(long long nd, long long st, long long en,
                               long long l, long long r) {
  if (en < l || r < st) return {inf, 0};
  if (l <= st && en <= r) return tree[nd];
  push(nd);
  long long mid = (st + en) >> 1;
  return min(qry(nd + nd, st, mid, l, r), qry(nd + nd + 1, mid + 1, en, l, r));
}
int32_t main() {
  {
    ios ::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  };
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> srr[i];
  }
  build(1, 1, n);
  for (long long i = 1; i <= n; i++) {
    auto p = qry(1, 1, n, 1, n);
    per[-p.second] = i;
    upd(1, 1, n, -p.second + 1, n, -i);
    upd(1, 1, n, -p.second, -p.second, inf);
  }
  for (long long i = 1; i <= n; i++) {
    cout << per[i] << " ";
  }
  cout << "\n";
}

```