// Arhiva de probleme - Schi
var
n, m, i, t, a, b : longint;
v : array[1..120100] of longint;
c, l : array[1..30000] of word;
f, g : text;
function max (a, b : longint) : longint;
begin
if (a > b) then max := a else max := b;
end;
procedure update (nod, st, dr : longint);
var
mij, t: longint;
begin
if (st = dr) then
begin v[nod] := 1; exit; end;
mij := (st + dr) shr 1;
t := nod shl 1;
update (t, st, mij);
update (t + 1, mij+1, dr);
v[nod] := v[t] + v[t+1];
end;
procedure update2 (nod, st, dr, loc, a : longint);
var
mij, t: longint;
begin
if (st = dr) then
begin v[nod] := 0; l[st] := loc; exit; end;
mij := (st + dr) shr 1;
t := nod shl 1;
if (v[t] >= a) then
update2 (t, st, mij, loc, a)
else
update2 (t + 1, mij+1, dr, loc, a - v[t]);
v[nod] := v[t] + v[t+1];
end;
begin
assign (f, 'schi.in'); assign (g, 'schi.out');
reset (f); rewrite (g);
reset (f); rewrite (g);
readln (f, n);
update (1, 1, n);
for i := 1 to n do
readln (f, c[i]);
for i := n downto 1 do
update2 (1, 1, n, i, c[i]);
for i := 1 to n do
writeln (g, l[i]);
close (f); close (g);
end.