import std.container;
import std.algorithm;
import std.range;
import std.array;
import std.stdio;
import std.utf;
import std.math;
import std.typecons;

alias type = multi;
struct TestCase
{
  mixin prettyPrinting;

  long n;
  @Dim("n") long[] a;

  void solve(long tc = -1)
  {
    if (iota(0, n).map!(i => pmod(a.at(i) + i, n)).array.sort.uniq.array.length == n)
      writeln("YES");
    else
      writeln("NO");
  }
}

struct Interval
{
  long l, h;

  bool empty()
  {
    return l > h;
  }
}

Interval intersect(Interval a, Interval b)
{
  return Interval(max(a.l, b.l), min(a.h, b.h));
}

struct If
{
  string condition;
}
enum ignore = If("false");
struct Dim
{
  string dimensions;
  int levels;
  this(string dimensions)
  {
    this.dimensions = dimensions;
    levels = cast(int)dimensions.count(",") + 1;
  }
}

template getArrayLevel(W)
{
  static if (isDynamicArray!W && !is(W == string))
    enum getArrayLevel = 1 + getArrayLevel!(removeArray!(W, 1));
  else
    enum getArrayLevel = 0;
}

static foreach(fieldName; 'a' .. cast(char)('z' + 1))
  {
    static if (fieldName != 'o')
      mixin("enum d", fieldName, " = Dim(\"", fieldName, "\");");
  }

mixin template prettyPrinting()
{
  string toString()
  {
    alias structType = typeof(this);
    auto res = appender!(string)();
    res.put(structType.stringof);
    res.put("(");
    static foreach(fieldName; FieldNameTuple!structType)
      {
        res.put(text(" ", fieldName, ": ", mixin(fieldName)));
      }
    res.put(" )");
    res.put("\n");
    return res[];
  }
}

struct Graph(N)
{
  size_t size;
  this(S)(S size)
  {
    adjacencyList.length = cast(size_t) size;
    this.size = cast(size_t) size;
    this.visited = makeSlice!bool(size);
  }
  N[][] adjacencyList;
  alias ne = neighbours;
  N[] neighbours(N n)
  {
    return adjacencyList.at(n);
  }
  alias bcon = biconnect;
  void biconnect(N a, N b)
  {
    adjacencyList.at(a) ~= b;
    adjacencyList.at(b) ~= a;
  }
  alias con = connect;
  void connect(N a, N b)
  {
    adjacencyList.at(a) ~= b;
  }
  void connect(R)(R edges)
  {
    foreach(ref edge; edges)
      {
        connect(edge[0], edge[1]);
      }
  }
  void biconnect(R)(R edges)
  {
    foreach(ref edge; edges)
      {
        biconnect(edge[0], edge[1]);
      }
  }
  alias deg = degree!long;
  auto degree(T)(N a)
  {
    return cast(T) adjacencyList.at(a).length;
  }

  auto visited = new bool[0];
  void dfs(Visitor)(long startNode)
  {
    auto visitor = Visitor.init;
    void internalDfs(long node)
    {
      visited.set(node, true);
      static if (is(typeof({visitor.n = node;})))
        visitor.n = node;
      static if (is(typeof({visitor.pre;})))
        visitor.pre;
      foreach(w; ne(node))
        if (!visited.at(w))
          {
            static if (is(typeof({visitor.w = w;})))
              visitor.w = w;
            static if (is(typeof(visitor.pren)))
              visitor.pren;
            internalDfs(w);
            static if (is(typeof(visitor.postn)))
              visitor.postn;
          }
      static if (is(typeof(visitor.post)))
        visitor.post;
    }
    internalDfs(startNode);
  }
  void dfs(long startNode)
  {
    struct DefVisitor {}
    dfs!DefVisitor(startNode);
  }
}

DList!string _words;

template removeArray(W, int times)
{
  static if (times == 0)
    alias removeArray = W;
  else static if (times == 1)
    alias removeArray = typeof(function(){W w; return w[0];}());
  else
    {
      static assert(isDynamicArray!W);
      alias removeArray = removeArray!(removeArray!(W, 1), times - 1);
    }
}

template baseType(W)
{
  static if (isDynamicArray!W && !is(W == string))
    alias baseType = baseType!(typeof((delegate() {W w; return w[0];})()));
  else
    alias baseType = W;
}

auto makeSlice(E, W, T...)(W size, T otherSizes)
{
  static if (T.length == 0)
    {
      E[] res;
      res.length = cast(size_t) size;
      return res;
    }
  else
    {
      typeof(makeSlice!E(otherSizes))[] res;
      res.length = cast(size_t) size;
      foreach(ref row; res)
        row = makeSlice!E(otherSizes);
      return res;
    }
}

void read(T...)(ref T t)
{
  void basicTypeRead(W)(ref W w)
  {
    import std.stdio: readln;
    while(_words.empty)
      {
        import std.array: split;
        foreach(word; readln.split)
          {
            _words.insertBack(word);
          }
      }
    import std.conv: to;
    string word = _words.front;
    _words.removeFront;
    w = to!W(word);
  }
  void iterableRead(W)(ref W w)
  {
    foreach(ref element; w)
      read(element);
  }
  void tupleRead(W)(ref W w)
  {
    static foreach(j; 0 .. W.length)
      read(w[j]);
  }
  void structRead(W)(ref W readStruct)
  {
    static foreach(fieldName; FieldNameTuple!W)
      {
        with(readStruct)
          {
            alias fieldSymbol = mixin(W.stringof, ".", fieldName);
            alias typeOfField = typeof(mixin(fieldName));
            static if (hasUDA!(fieldSymbol, If))
              enum condition = getUDAs!(fieldSymbol, If)[0].condition;
            else
              enum condition = "true";

            if (mixin(condition))
              {
                static if (hasUDA!(fieldSymbol, Dim))
                  {
                    static assert(isDynamicArray!(typeOfField)
                                  , text(W.stringof, ".", fieldName, " has Dim UDA but isn't a Dynamic Array."));
                    enum uda = getUDAs!(fieldSymbol, Dim)[0];
                    static assert(getArrayLevel!(typeOfField) == uda.levels,
                                  text(W.stringof, ".", fieldName, " has a Dim UDA with different number of dimensions than it's type."));
                    mixin(fieldName) = mixin(q{makeSlice!(baseType!typeOfField)(}, uda.dimensions, q{)});
                  }
                else static if (isDynamicArray!typeOfField && !is(typeOfField == string))
                  {
                    pragma(msg, "Warning: You probably want to add dimension to input ", W.stringof, ".", fieldName);
                  }
                read(mixin(fieldName));
              }
          }
      }
  }
  static foreach(i; 0 .. T.length)
    {
      static if (isBasicType!(T[i]) || is(T[i] == string))
        basicTypeRead(t[i]);
      else static if (is(typeof({foreach(ref e; t[i]){}})))
        iterableRead(t[i]);
      else static if (isTuple!(T[i]))
        tupleRead(t[i]);
      else static if (isAggregateType!(T[i]))
        structRead(t[i]);
    }
}

auto next(T)()
{
  T t;
  read(t);
  return t;
}

size_t ind(T)(T t)
{
  return cast(size_t)t;
}

ref auto at(R, I)(ref R r, I i)
{
  return r[cast(size_t)i];
}

void set(R, I, V)(ref R r, I i, V v)
{
  r[cast(size_t)i] = v;
}

import std.conv;
import std.traits;
import std.meta;
int _loglevel = -1;
void _log(string functionName, argSeq...)()
{
  foreach(i; 0 .. _loglevel * 4)
    write(' ');
  write(functionName);
  static foreach(arg; argSeq)
    {
      write(" ", arg.stringof, " = ", arg);
    }
  writeln;
}
enum logCall =
  q{
    debug
    {
     {
     _loglevel++;
     alias _parameterTuple = ParameterIdentifierTuple!(mixin(split(__FUNCTION__, ".").back));
     static if (_parameterTuple.length > 0)
       mixin(`_log!(__FUNCTION__, `, [_parameterTuple].joiner(", ").array, `);`);
     else
       _log!(__FUNCTION__);
      }
     foreach(i; 0 .. _loglevel * 4) write(' ');
     writeln('{');
     scope(exit)
       {
         foreach(i; 0 .. _loglevel * 4) write(' ');
         writeln('}');
         _loglevel--;
       }
    }
};

void logSym(S...)(int line = __LINE__, string file = __FUNCTION__)
{
  debug
    {
      foreach(i; 0 .. _loglevel * 4) write(' ');
      write(file, "(", line, "):");
      static foreach(s; S)
        write(" ", s.stringof, " = ", s);
      writeln;

    }
}

Array!E makeArray(E, S)(S size, lazy E value)
{
  auto a = Array!E();
  a.length = cast(size_t) size;
  foreach(ref ai; a)
    ai = value();
  return a;
}
Array!E makeArray(E, S)(S size)
{
  auto a = Array!E();
  a.length = cast(size_t) size;
  return a;
}

template mem(alias F)
{
  ReturnType!F[Tuple!(Parameters!F)] table;
  ReturnType!F mem(Parameters!F args)
  {
    return table.require(tuple(args), F(args));
  }
}

string input(string names, string type = "long")
{
  return text(type, " ", names, "; read(", names, ");");
}

auto pmod(T, W)(T t, W w)
{
  return (t%w + w) % w;
}

void rep(S, F)(F f, S times)
{
  static if (is(typeof(f(i))))
    foreach(i; 0 .. times)
      f(i);
  else
    foreach(i; 0 .. times)
      f();
}

void multi()
{
  foreach(tc; 0 .. next!long)
    next!TestCase.solve(tc);
}

void single()
{
  auto tc = next!TestCase;
  tc.solve;
}

void main()
{
  type;
}

import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main ()
{
	readln;
	int n;
	while (readf !(" %s") (n) > 0)
	{
		readln;
		auto a = readln.splitter.map !(to !(int)).array;
		a[] += n.iota.array[];
		a[] = ((a[] % n) + n) % n;
		sort (a);
		writeln (equal (a, n.iota) ? "YES" : "NO");
	}
}

import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }

void main() {
  try {
    for (; ; ) {
      const numCases = readInt();
      foreach (caseId; 0 .. numCases) {
        const N = readInt();
        auto A = new long[N];
        foreach (i; 0 .. N) {
          A[i] = readLong();
        }

        auto rs = new long[N];
        foreach (i; 0 .. N) {
          rs[i] = ((i + A[i]) % N + N) % N;
        }
        rs.sort;

        bool ans = true;
        foreach (i; 0 .. N) {
          ans = ans && (rs[i] == i);
        }
        writeln(ans ? "YES" : "NO");
      }
    }
  } catch (EOFException e) {
  }
}

import std.container;
import std.algorithm;
import std.range;
import std.array;
import std.stdio;
import std.utf;
import std.math;
import std.typecons;

alias type = multi;
struct TestCase
{
  mixin prettyPrinting;

  long n;
  @Dim("n") long[] a;

  void solve(long tc = -1)
  {
    auto moved = iota(0, n).map!(i => pmod(a.at(i) + i, n)).array;
    auto movedSet = redBlackTree!long();
    foreach(m; moved)
      movedSet.insert(m);
    if (movedSet.length == n)
      writeln("YES");
    else
      writeln("NO");
  }
}

struct Interval
{
  long l, h;

  bool empty()
  {
    return l > h;
  }
}

Interval intersect(Interval a, Interval b)
{
  return Interval(max(a.l, b.l), min(a.h, b.h));
}

struct If
{
  string condition;
}
enum ignore = If("false");
struct Dim
{
  string dimensions;
  int levels;
  this(string dimensions)
  {
    this.dimensions = dimensions;
    levels = cast(int)dimensions.count(",") + 1;
  }
}

template getArrayLevel(W)
{
  static if (isDynamicArray!W && !is(W == string))
    enum getArrayLevel = 1 + getArrayLevel!(removeArray!(W, 1));
  else
    enum getArrayLevel = 0;
}

static foreach(fieldName; 'a' .. cast(char)('z' + 1))
  {
    static if (fieldName != 'o')
      mixin("enum d", fieldName, " = Dim(\"", fieldName, "\");");
  }

mixin template prettyPrinting()
{
  string toString()
  {
    alias structType = typeof(this);
    auto res = appender!(string)();
    res.put(structType.stringof);
    res.put("(");
    static foreach(fieldName; FieldNameTuple!structType)
      {
        res.put(text(" ", fieldName, ": ", mixin(fieldName)));
      }
    res.put(" )");
    res.put("\n");
    return res[];
  }
}

struct Graph(N)
{
  size_t size;
  this(S)(S size)
  {
    adjacencyList.length = cast(size_t) size;
    this.size = cast(size_t) size;
    this.visited = makeSlice!bool(size);
  }
  N[][] adjacencyList;
  alias ne = neighbours;
  N[] neighbours(N n)
  {
    return adjacencyList.at(n);
  }
  alias bcon = biconnect;
  void biconnect(N a, N b)
  {
    adjacencyList.at(a) ~= b;
    adjacencyList.at(b) ~= a;
  }
  alias con = connect;
  void connect(N a, N b)
  {
    adjacencyList.at(a) ~= b;
  }
  void connect(R)(R edges)
  {
    foreach(ref edge; edges)
      {
        connect(edge[0], edge[1]);
      }
  }
  void biconnect(R)(R edges)
  {
    foreach(ref edge; edges)
      {
        biconnect(edge[0], edge[1]);
      }
  }
  alias deg = degree!long;
  auto degree(T)(N a)
  {
    return cast(T) adjacencyList.at(a).length;
  }

  auto visited = new bool[0];
  void dfs(Visitor)(long startNode)
  {
    auto visitor = Visitor.init;
    void internalDfs(long node)
    {
      visited.set(node, true);
      static if (is(typeof({visitor.n = node;})))
        visitor.n = node;
      static if (is(typeof({visitor.pre;})))
        visitor.pre;
      foreach(w; ne(node))
        if (!visited.at(w))
          {
            static if (is(typeof({visitor.w = w;})))
              visitor.w = w;
            static if (is(typeof(visitor.pren)))
              visitor.pren;
            internalDfs(w);
            static if (is(typeof(visitor.postn)))
              visitor.postn;
          }
      static if (is(typeof(visitor.post)))
        visitor.post;
    }
    internalDfs(startNode);
  }
  void dfs(long startNode)
  {
    struct DefVisitor {}
    dfs!DefVisitor(startNode);
  }
}

DList!string _words;

template removeArray(W, int times)
{
  static if (times == 0)
    alias removeArray = W;
  else static if (times == 1)
    alias removeArray = typeof(function(){W w; return w[0];}());
  else
    {
      static assert(isDynamicArray!W);
      alias removeArray = removeArray!(removeArray!(W, 1), times - 1);
    }
}

template baseType(W)
{
  static if (isDynamicArray!W && !is(W == string))
    alias baseType = baseType!(typeof((delegate() {W w; return w[0];})()));
  else
    alias baseType = W;
}

auto makeSlice(E, W, T...)(W size, T otherSizes)
{
  static if (T.length == 0)
    {
      E[] res;
      res.length = cast(size_t) size;
      return res;
    }
  else
    {
      typeof(makeSlice!E(otherSizes))[] res;
      res.length = cast(size_t) size;
      foreach(ref row; res)
        row = makeSlice!E(otherSizes);
      return res;
    }
}

void read(T...)(ref T t)
{
  void basicTypeRead(W)(ref W w)
  {
    import std.stdio: readln;
    while(_words.empty)
      {
        import std.array: split;
        foreach(word; readln.split)
          {
            _words.insertBack(word);
          }
      }
    import std.conv: to;
    string word = _words.front;
    _words.removeFront;
    w = to!W(word);
  }
  void iterableRead(W)(ref W w)
  {
    foreach(ref element; w)
      read(element);
  }
  void tupleRead(W)(ref W w)
  {
    static foreach(j; 0 .. W.length)
      read(w[j]);
  }
  void structRead(W)(ref W readStruct)
  {
    static foreach(fieldName; FieldNameTuple!W)
      {
        with(readStruct)
          {
            alias fieldSymbol = mixin(W.stringof, ".", fieldName);
            alias typeOfField = typeof(mixin(fieldName));
            static if (hasUDA!(fieldSymbol, If))
              enum condition = getUDAs!(fieldSymbol, If)[0].condition;
            else
              enum condition = "true";

            if (mixin(condition))
              {
                static if (hasUDA!(fieldSymbol, Dim))
                  {
                    static assert(isDynamicArray!(typeOfField)
                                  , text(W.stringof, ".", fieldName, " has Dim UDA but isn't a Dynamic Array."));
                    enum uda = getUDAs!(fieldSymbol, Dim)[0];
                    static assert(getArrayLevel!(typeOfField) == uda.levels,
                                  text(W.stringof, ".", fieldName, " has a Dim UDA with different number of dimensions than it's type."));
                    mixin(fieldName) = mixin(q{makeSlice!(baseType!typeOfField)(}, uda.dimensions, q{)});
                  }
                else static if (isDynamicArray!typeOfField && !is(typeOfField == string))
                  {
                    pragma(msg, "Warning: You probably want to add dimension to input ", W.stringof, ".", fieldName);
                  }
                read(mixin(fieldName));
              }
          }
      }
  }
  static foreach(i; 0 .. T.length)
    {
      static if (isBasicType!(T[i]) || is(T[i] == string))
        basicTypeRead(t[i]);
      else static if (is(typeof({foreach(ref e; t[i]){}})))
        iterableRead(t[i]);
      else static if (isTuple!(T[i]))
        tupleRead(t[i]);
      else static if (isAggregateType!(T[i]))
        structRead(t[i]);
    }
}

auto next(T)()
{
  T t;
  read(t);
  return t;
}

size_t ind(T)(T t)
{
  return cast(size_t)t;
}

ref auto at(R, I)(ref R r, I i)
{
  return r[cast(size_t)i];
}

void set(R, I, V)(ref R r, I i, V v)
{
  r[cast(size_t)i] = v;
}

import std.conv;
import std.traits;
import std.meta;
int _loglevel = -1;
void _log(string functionName, argSeq...)()
{
  foreach(i; 0 .. _loglevel * 4)
    write(' ');
  write(functionName);
  static foreach(arg; argSeq)
    {
      write(" ", arg.stringof, " = ", arg);
    }
  writeln;
}
enum logCall =
  q{
    debug
    {
     {
     _loglevel++;
     alias _parameterTuple = ParameterIdentifierTuple!(mixin(split(__FUNCTION__, ".").back));
     static if (_parameterTuple.length > 0)
       mixin(`_log!(__FUNCTION__, `, [_parameterTuple].joiner(", ").array, `);`);
     else
       _log!(__FUNCTION__);
      }
     foreach(i; 0 .. _loglevel * 4) write(' ');
     writeln('{');
     scope(exit)
       {
         foreach(i; 0 .. _loglevel * 4) write(' ');
         writeln('}');
         _loglevel--;
       }
    }
};

void logSym(S...)(int line = __LINE__, string file = __FUNCTION__)
{
  debug
    {
      foreach(i; 0 .. _loglevel * 4) write(' ');
      write(file, "(", line, "):");
      static foreach(s; S)
        write(" ", s.stringof, " = ", s);
      writeln;

    }
}

Array!E makeArray(E, S)(S size, lazy E value)
{
  auto a = Array!E();
  a.length = cast(size_t) size;
  foreach(ref ai; a)
    ai = value();
  return a;
}
Array!E makeArray(E, S)(S size)
{
  auto a = Array!E();
  a.length = cast(size_t) size;
  return a;
}

template mem(alias F)
{
  ReturnType!F[Tuple!(Parameters!F)] table;
  ReturnType!F mem(Parameters!F args)
  {
    return table.require(tuple(args), F(args));
  }
}

string input(string names, string type = "long")
{
  return text(type, " ", names, "; read(", names, ");");
}

auto pmod(T, W)(T t, W w)
{
  return (t%w + w) % w;
}

void rep(S, F)(F f, S times)
{
  static if (is(typeof(f(i))))
    foreach(i; 0 .. times)
      f(i);
  else
    foreach(i; 0 .. times)
      f();
}

void multi()
{
  foreach(tc; 0 .. next!long)
    next!TestCase.solve(tc);
}

void single()
{
  auto tc = next!TestCase;
  tc.solve;
}

void main()
{
  type;
}

import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { x.modm(y.modpow(mod - 2)); }

void main()
{
	auto t = RD!int;
	auto ans = new bool[](t);
	foreach (ti; 0..t)
	{
		auto n = RD!int;
		auto a = RDA;

		auto used = new bool[](n);
		bool ok = true;
		foreach (i; 0..n)
		{
			auto p = (i+a[i]+n);
			p += (abs(p/n)+1)*n;
			p %= n;
			if (used[cast(int)p])
			{
				ok = false;
				break;
			}
			used[cast(int)p] = true;
		}
		ans[ti] = ok;
	}

	foreach (e; ans)
		writeln(e ? "YES" : "NO");
	stdout.flush;
	debug readln;
}

import std.container;
import std.algorithm;
import std.range;
import std.array;
import std.stdio;
import std.utf;
import std.math;
import std.typecons;

alias type = multi;
struct TestCase
{
  mixin prettyPrinting;

  long n;
  @Dim("n") long[] a;

  void solve(long tc = -1)
  {
    if (iota(0, n).map!(i => pmod(a.at(i) + i, n)).uniq.array.length == n)
      writeln("YES");
    else
      writeln("NO");
  }
}

struct Interval
{
  long l, h;

  bool empty()
  {
    return l > h;
  }
}

Interval intersect(Interval a, Interval b)
{
  return Interval(max(a.l, b.l), min(a.h, b.h));
}

struct If
{
  string condition;
}
enum ignore = If("false");
struct Dim
{
  string dimensions;
  int levels;
  this(string dimensions)
  {
    this.dimensions = dimensions;
    levels = cast(int)dimensions.count(",") + 1;
  }
}

template getArrayLevel(W)
{
  static if (isDynamicArray!W && !is(W == string))
    enum getArrayLevel = 1 + getArrayLevel!(removeArray!(W, 1));
  else
    enum getArrayLevel = 0;
}

static foreach(fieldName; 'a' .. cast(char)('z' + 1))
  {
    static if (fieldName != 'o')
      mixin("enum d", fieldName, " = Dim(\"", fieldName, "\");");
  }

mixin template prettyPrinting()
{
  string toString()
  {
    alias structType = typeof(this);
    auto res = appender!(string)();
    res.put(structType.stringof);
    res.put("(");
    static foreach(fieldName; FieldNameTuple!structType)
      {
        res.put(text(" ", fieldName, ": ", mixin(fieldName)));
      }
    res.put(" )");
    res.put("\n");
    return res[];
  }
}

struct Graph(N)
{
  size_t size;
  this(S)(S size)
  {
    adjacencyList.length = cast(size_t) size;
    this.size = cast(size_t) size;
    this.visited = makeSlice!bool(size);
  }
  N[][] adjacencyList;
  alias ne = neighbours;
  N[] neighbours(N n)
  {
    return adjacencyList.at(n);
  }
  alias bcon = biconnect;
  void biconnect(N a, N b)
  {
    adjacencyList.at(a) ~= b;
    adjacencyList.at(b) ~= a;
  }
  alias con = connect;
  void connect(N a, N b)
  {
    adjacencyList.at(a) ~= b;
  }
  void connect(R)(R edges)
  {
    foreach(ref edge; edges)
      {
        connect(edge[0], edge[1]);
      }
  }
  void biconnect(R)(R edges)
  {
    foreach(ref edge; edges)
      {
        biconnect(edge[0], edge[1]);
      }
  }
  alias deg = degree!long;
  auto degree(T)(N a)
  {
    return cast(T) adjacencyList.at(a).length;
  }

  auto visited = new bool[0];
  void dfs(Visitor)(long startNode)
  {
    auto visitor = Visitor.init;
    void internalDfs(long node)
    {
      visited.set(node, true);
      static if (is(typeof({visitor.n = node;})))
        visitor.n = node;
      static if (is(typeof({visitor.pre;})))
        visitor.pre;
      foreach(w; ne(node))
        if (!visited.at(w))
          {
            static if (is(typeof({visitor.w = w;})))
              visitor.w = w;
            static if (is(typeof(visitor.pren)))
              visitor.pren;
            internalDfs(w);
            static if (is(typeof(visitor.postn)))
              visitor.postn;
          }
      static if (is(typeof(visitor.post)))
        visitor.post;
    }
    internalDfs(startNode);
  }
  void dfs(long startNode)
  {
    struct DefVisitor {}
    dfs!DefVisitor(startNode);
  }
}

DList!string _words;

template removeArray(W, int times)
{
  static if (times == 0)
    alias removeArray = W;
  else static if (times == 1)
    alias removeArray = typeof(function(){W w; return w[0];}());
  else
    {
      static assert(isDynamicArray!W);
      alias removeArray = removeArray!(removeArray!(W, 1), times - 1);
    }
}

template baseType(W)
{
  static if (isDynamicArray!W && !is(W == string))
    alias baseType = baseType!(typeof((delegate() {W w; return w[0];})()));
  else
    alias baseType = W;
}

auto makeSlice(E, W, T...)(W size, T otherSizes)
{
  static if (T.length == 0)
    {
      E[] res;
      res.length = cast(size_t) size;
      return res;
    }
  else
    {
      typeof(makeSlice!E(otherSizes))[] res;
      res.length = cast(size_t) size;
      foreach(ref row; res)
        row = makeSlice!E(otherSizes);
      return res;
    }
}

void read(T...)(ref T t)
{
  void basicTypeRead(W)(ref W w)
  {
    import std.stdio: readln;
    while(_words.empty)
      {
        import std.array: split;
        foreach(word; readln.split)
          {
            _words.insertBack(word);
          }
      }
    import std.conv: to;
    string word = _words.front;
    _words.removeFront;
    w = to!W(word);
  }
  void iterableRead(W)(ref W w)
  {
    foreach(ref element; w)
      read(element);
  }
  void tupleRead(W)(ref W w)
  {
    static foreach(j; 0 .. W.length)
      read(w[j]);
  }
  void structRead(W)(ref W readStruct)
  {
    static foreach(fieldName; FieldNameTuple!W)
      {
        with(readStruct)
          {
            alias fieldSymbol = mixin(W.stringof, ".", fieldName);
            alias typeOfField = typeof(mixin(fieldName));
            static if (hasUDA!(fieldSymbol, If))
              enum condition = getUDAs!(fieldSymbol, If)[0].condition;
            else
              enum condition = "true";

            if (mixin(condition))
              {
                static if (hasUDA!(fieldSymbol, Dim))
                  {
                    static assert(isDynamicArray!(typeOfField)
                                  , text(W.stringof, ".", fieldName, " has Dim UDA but isn't a Dynamic Array."));
                    enum uda = getUDAs!(fieldSymbol, Dim)[0];
                    static assert(getArrayLevel!(typeOfField) == uda.levels,
                                  text(W.stringof, ".", fieldName, " has a Dim UDA with different number of dimensions than it's type."));
                    mixin(fieldName) = mixin(q{makeSlice!(baseType!typeOfField)(}, uda.dimensions, q{)});
                  }
                else static if (isDynamicArray!typeOfField && !is(typeOfField == string))
                  {
                    pragma(msg, "Warning: You probably want to add dimension to input ", W.stringof, ".", fieldName);
                  }
                read(mixin(fieldName));
              }
          }
      }
  }
  static foreach(i; 0 .. T.length)
    {
      static if (isBasicType!(T[i]) || is(T[i] == string))
        basicTypeRead(t[i]);
      else static if (is(typeof({foreach(ref e; t[i]){}})))
        iterableRead(t[i]);
      else static if (isTuple!(T[i]))
        tupleRead(t[i]);
      else static if (isAggregateType!(T[i]))
        structRead(t[i]);
    }
}

auto next(T)()
{
  T t;
  read(t);
  return t;
}

size_t ind(T)(T t)
{
  return cast(size_t)t;
}

ref auto at(R, I)(ref R r, I i)
{
  return r[cast(size_t)i];
}

void set(R, I, V)(ref R r, I i, V v)
{
  r[cast(size_t)i] = v;
}

import std.conv;
import std.traits;
import std.meta;
int _loglevel = -1;
void _log(string functionName, argSeq...)()
{
  foreach(i; 0 .. _loglevel * 4)
    write(' ');
  write(functionName);
  static foreach(arg; argSeq)
    {
      write(" ", arg.stringof, " = ", arg);
    }
  writeln;
}
enum logCall =
  q{
    debug
    {
     {
     _loglevel++;
     alias _parameterTuple = ParameterIdentifierTuple!(mixin(split(__FUNCTION__, ".").back));
     static if (_parameterTuple.length > 0)
       mixin(`_log!(__FUNCTION__, `, [_parameterTuple].joiner(", ").array, `);`);
     else
       _log!(__FUNCTION__);
      }
     foreach(i; 0 .. _loglevel * 4) write(' ');
     writeln('{');
     scope(exit)
       {
         foreach(i; 0 .. _loglevel * 4) write(' ');
         writeln('}');
         _loglevel--;
       }
    }
};

void logSym(S...)(int line = __LINE__, string file = __FUNCTION__)
{
  debug
    {
      foreach(i; 0 .. _loglevel * 4) write(' ');
      write(file, "(", line, "):");
      static foreach(s; S)
        write(" ", s.stringof, " = ", s);
      writeln;

    }
}

Array!E makeArray(E, S)(S size, lazy E value)
{
  auto a = Array!E();
  a.length = cast(size_t) size;
  foreach(ref ai; a)
    ai = value();
  return a;
}
Array!E makeArray(E, S)(S size)
{
  auto a = Array!E();
  a.length = cast(size_t) size;
  return a;
}

template mem(alias F)
{
  ReturnType!F[Tuple!(Parameters!F)] table;
  ReturnType!F mem(Parameters!F args)
  {
    return table.require(tuple(args), F(args));
  }
}

string input(string names, string type = "long")
{
  return text(type, " ", names, "; read(", names, ");");
}

auto pmod(T, W)(T t, W w)
{
  return (t%w + w) % w;
}

void rep(S, F)(F f, S times)
{
  static if (is(typeof(f(i))))
    foreach(i; 0 .. times)
      f(i);
  else
    foreach(i; 0 .. times)
      f();
}

void multi()
{
  foreach(tc; 0 .. next!long)
    next!TestCase.solve(tc);
}

void single()
{
  auto tc = next!TestCase;
  tc.solve;
}

void main()
{
  type;
}


import std.algorithm;
import std.range;
import std.stdio;
import std.typecons;
import std.traits;
import std.array;
struct Input
{
  T next(T)()
  {
    import std.conv;
    return to!T(nextWord);
  }
  string nextWord()
  {
    if (_nextWords.empty)
	_nextWords.insertFront(readln().split);
    string word = _nextWords.front; _nextWords.removeFront;
    return word;
  }
  import std.container;
  DList!string _nextWords;
}
Input input;
void read(T...)(ref T args)
{
  import std.traits;
  static foreach(i; 0 .. T.length)
    static if(isArray!(T[i]) && !is(T[i] == string))
      foreach(ref e; args[i])
    	read(e);
    else static if(isTuple!(T[i]))
      static foreach(n; 0 .. T[i].Types.length)
	read(args[i][n]);
    else
      args[i] = input.next!(typeof(args[i]))();
}
auto itup(alias k, alias F)()
{
  alias T = Parameters!F;
  foreach(i; 0 .. k)
    {
      T t; get(t);
      F(t);
    }
}
alias get = read;
void wone(T)(T t, char end)
{
  static if(isArray!T && !is(T == string))
    {
      foreach(i; 0 .. t.length - 1)
	  write(t[i], ' ');
      write(t[$ - 1], end);
    }
  else
      write(t, end);
}
void wr(T...)(T t)
{
  static foreach(i; 0 .. T.length)
    static if(i + 1 < T.length)
      wone(t[i], ' ');
    else
      wone(t[i], '\n');
}
void ans(T...)(T t)
{
  import core.stdc.stdlib;
  wr(t);
  exit(0);
}

void main()
{
  int n, m; get(n, m);
  auto trips = new int[n + 1];
  int k = 0;
  foreach(i; 2 .. n + 1)
    trips[i] = trips[i - 1] + cast(int)(i - 1) / 2,
      k = cast(int)(k == 0? (trips[i] > m? i - 1 : 0) : k);
  int remainingLength = n - k - 1;
  int border = 2*k + 1 - 2*(m - trips[k]);
  int startValue = max(2*border, remainingLength - 1);
  int jump = border + 1;
  ans(m > trips[n]? [-1]:
      m == trips[n]? iota(1, 1 + n).array:
      m == 0? iota(n - 1, 2*n - 1).array:
      chain(iota(1, 1 + k),
	    [border],
	    iota(0, remainingLength).map!(i => startValue + jump * i))
      .array);
}

import std.algorithm;
import std.range;
import std.stdio;
import std.typecons;
import std.traits;
import std.array;
struct Input
{
  T next(T)()
  {
    import std.conv;
    return to!T(nextWord);
  }
  string nextWord()
  {
    if (_nextWords.empty)
	_nextWords.insertFront(readln().split);
    string word = _nextWords.front; _nextWords.removeFront;
    return word;
  }
  import std.container;
  DList!string _nextWords;
}
Input input;
void read(T...)(ref T args)
{
  import std.traits;
  static foreach(i; 0 .. T.length)
    static if(isArray!(T[i]) && !is(T[i] == string))
      foreach(ref e; args[i])
    	read(e);
    else static if(isTuple!(T[i]))
      static foreach(n; 0 .. T[i].Types.length)
	read(args[i][n]);
    else
      args[i] = input.next!(typeof(args[i]))();
}
auto itup(alias k, alias F)()
{
  alias T = Parameters!F;
  foreach(i; 0 .. k)
    {
      T t; get(t);
      F(t);
    }
}
alias get = read;
void wone(T)(T t, char end)
{
  static if(isArray!T && !is(T == string))
    {
      foreach(i; 0 .. t.length - 1)
	  write(t[i], ' ');
      write(t[$ - 1], end);
    }
  else
      write(t, end);
}
void wr(T...)(T t)
{
  static foreach(i; 0 .. T.length)
    static if(i + 1 < T.length)
      wone(t[i], ' ');
    else
      wone(t[i], '\n');
}
void ans(T...)(T t)
{
  import core.stdc.stdlib;
  wr(t);
  exit(0);
}

int main()
{
  int n, m;
  get(n, m);
  int[] trips = new int[n + 1];
  trips[1] = 0;
  foreach(i; iota(2, 1 + n))
      trips[i] = trips[i - 1] + (i - 1) / 2;
  if (m > trips[n])
    ans(-1);
  if (m == trips[n])
    ans(iota(1, 1 + n).array);
  if (m == 0)
    ans(iota(n - 1, 2*n - 1).array);
  size_t k = 0;
  foreach(i, t; trips)
      if (t > m)
	{
	  k = i - 1;
	  break;
	}
  auto remainingLength = n - k - 1;
  auto border = 2*k + 1 - 2*(m - trips[k]);
  auto startValue = max(2*border, remainingLength - 1);
  auto jump = border + 1;
  ans(chain(iota(1, 1 + k).array,
	    [border],
	    iota(0, remainingLength).map!(i => startValue + jump * i))
      .array);
  assert(0);
}

import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }

void main() {
  /*
  debug {
    enum lim = 16;
    auto anss = new int[][][][](lim + 1, lim^^2 + 1);
    foreach (p; 0 .. 1 << lim) {
      const n = popcnt(p);
      int m;
      foreach (a; 1 .. lim + 1) foreach (b; a + 1 .. lim - a + 1) {
        if ((p & 1 << (a - 1)) && (p & 1 << (b - 1)) && (p & 1 << (a + b - 1))) {
          ++m;
        }
      }
      anss[n][m] ~= iota(1, lim + 1).filter!(a => (p & 1 << (a - 1))).array;
    }
    foreach (n; 0 .. lim + 1) {
      foreach (m; 0 .. n^^2 + 1) {
        writeln(n, " ", m, ": ", anss[n][m]);
      }
    }
  }
  */

  try {
    for (; ; ) {
      const N = readInt();
      const M = readInt();

      int[] ans;
      foreach (x; 1 .. N + 1) {
        // x, ..., x + N
        int all;
        foreach (i; 0 .. N + 1) {
          // 0 <= i < j <= N, (x + i) + (x + j) <= x + N
          const lb = i + 1;
          const ub = N - x - i;
          if (lb <= ub) {
            all += (ub - lb + 1);
          }
        }
        foreach (y; 0 .. N + 1) {
          // x, ..., x + y - 1, x + y + 1, ..., x + N
          int num = all;
          /*
            0 <= i < j <= y - 1, (x + i) + (x + j) = x + y
            0 <= i < -i - x + y <= y - 1
          */
          {
            const lb = max(0, -x - 1);
            const ub = ((-x + y - 1) - (((-x + y - 1)) & 1)) / 2;
            if (lb <= ub) {
              num -= (ub - lb + 1);
            }
          }
          // 0 <= i <= N, (x + y) + (x + i) <= x + N
          {
            const lb = 0;
            const ub = min(N, N - x - y);
            if (lb <= ub) {
              num -= (ub - lb + 1);
            }
          }
          // (x + y) + (x + y) <= x + N
          if ((x + y) + (x + y) <= x + N) {
            num += 1;
          }
          debug {
            // writeln(x, " ", y, ": ", num);
          }
          if (num == M) {
            ans = iota(x, x + y).array ~ iota(x + y + 1, x + N + 1).array;
            goto found;
          }
        }
      }
      writeln("-1");
      continue;
     found:
      assert(ans.length == N);
      foreach (i; 0 .. N) {
        if (i > 0) write(" ");
        write(ans[i]);
      }
      writeln();

      debug {
        bool[int] app;
        foreach (i; 0 .. N) {
          app[ans[i]] = true;
        }
        int cnt;
        foreach (i; 0 .. N) foreach (j; i + 1 .. N) {
          if ((ans[i] + ans[j]) in app) {
            ++cnt;
          }
        }
        assert(cnt == M);
      }
    }
  } catch (EOFException e) {
  }
}

import std.algorithm;
import std.range;
import std.stdio;
import std.typecons;
import std.traits;
import std.array;
struct Input
{
  T next(T)()
  {
    import std.conv;
    return to!T(nextWord);
  }
  string nextWord()
  {
    if (_nextWords.empty)
	_nextWords.insertFront(readln().split);
    string word = _nextWords.front; _nextWords.removeFront;
    return word;
  }
  import std.container;
  DList!string _nextWords;
}
Input input;
void read(T...)(ref T args)
{
  import std.traits;
  static foreach(i; 0 .. T.length)
    static if(isArray!(T[i]) && !is(T[i] == string))
      foreach(ref e; args[i])
    	read(e);
    else static if(isTuple!(T[i]))
      static foreach(n; 0 .. T[i].Types.length)
	read(args[i][n]);
    else
      args[i] = input.next!(typeof(args[i]))();
}
auto itup(alias k, alias F)()
{
  alias T = Parameters!F;
  foreach(i; 0 .. k)
    {
      T t; get(t);
      F(t);
    }
}
alias get = read;
void wone(T)(T t, char end)
{
  static if(isArray!T && !is(T == string))
    {
      foreach(i; 0 .. t.length - 1)
	  write(t[i], ' ');
      write(t[$ - 1], end);
    }
  else
      write(t, end);
}
void wr(T...)(T t)
{
  static foreach(i; 0 .. T.length)
    static if(i + 1 < T.length)
      wone(t[i], ' ');
    else
      wone(t[i], '\n');
}
void ans(T...)(T t)
{
  import core.stdc.stdlib;
  wr(t);
  exit(0);
}

int main()
{
  int n, m;
  get(n, m);
  int[] trips = new int[n + 1];
  trips[1] = 0;
  foreach(i; iota(2, 1 + n))
      trips[i] = trips[i - 1] + (i - 1) / 2;
  if (m > trips[n])
    ans(-1);
  if (m == trips[n])
    ans(iota(1, 1 + n).array);
  if (m == 0)
    ans(iota(n - 1, 2*n - 1).array);
  uint k = 0;
  foreach(i, t; trips)
      if (t > m)
	  k = i - 1;
  auto remainingLength = n - k - 1;
  auto startValue = max(2*k + 3 - (m - trips[k]), remainingLength - 1);
  ans(chain(iota(1, 1 + k).array,
	    [2 * k + 1 - 2*(m - trips[k])],
	    iota(startValue, startValue + remainingLength))
      .array);
  assert(0);
}

import std.algorithm;
import std.range;
import std.stdio;
import std.typecons;
import std.traits;
import std.array;
struct Input
{
  T next(T)()
  {
    import std.conv;
    return to!T(nextWord);
  }
  string nextWord()
  {
    if (_nextWords.empty)
	_nextWords.insertFront(readln().split);
    string word = _nextWords.front; _nextWords.removeFront;
    return word;
  }
  import std.container;
  DList!string _nextWords;
}
Input input;
void read(T...)(ref T args)
{
  import std.traits;
  static foreach(i; 0 .. T.length)
    static if(isArray!(T[i]) && !is(T[i] == string))
      foreach(ref e; args[i])
    	read(e);
    else static if(isTuple!(T[i]))
      static foreach(n; 0 .. T[i].Types.length)
	read(args[i][n]);
    else
      args[i] = input.next!(typeof(args[i]))();
}
auto itup(alias k, alias F)()
{
  alias T = Parameters!F;
  foreach(i; 0 .. k)
    {
      T t; get(t);
      F(t);
    }
}
alias get = read;
void wone(T)(T t, char end)
{
  static if(isArray!T && !is(T == string))
    {
      foreach(i; 0 .. t.length - 1)
	  write(t[i], ' ');
      write(t[$ - 1], end);
    }
  else
      write(t, end);
}
void wr(T...)(T t)
{
  static foreach(i; 0 .. T.length)
    static if(i + 1 < T.length)
      wone(t[i], ' ');
    else
      wone(t[i], '\n');
}
void ans(T...)(T t)
{
  import core.stdc.stdlib;
  wr(t);
  exit(0);
}

int main()
{
  int n, m;
  get(n, m);
  int[] trips = new int[n + 1];
  trips[1] = 0;
  foreach(i; iota(2, 1 + n))
      trips[i] = trips[i - 1] + (i - 1) / 2;
  if (m > trips[n])
    ans(-1);
  if (m == trips[n])
    ans(iota(1, 1 + n).array);
  if (m == 0)
    ans(iota(n - 1, 2*n - 1).array);
  size_t k = 0;
  foreach(i, t; trips)
      if (t > m)
	{
	  k = i - 1;
	  break;
	}
  auto remainingLength = n - k - 1;
  auto border = 2*k + 1 - 2*(m - trips[k]);
  auto startValue = max(2*border, remainingLength - 1);
  ans(chain(iota(1, 1 + k).array,
	    [border],
	    iota(startValue, startValue + remainingLength))
      .array);
  assert(0);
}

import std.algorithm;
import std.range;
import std.stdio;
import std.typecons;
import std.traits;
import std.array;
struct Input
{
  T next(T)()
  {
    import std.conv;
    return to!T(nextWord);
  }
  string nextWord()
  {
    if (_nextWords.empty)
	_nextWords.insertFront(readln().split);
    string word = _nextWords.front; _nextWords.removeFront;
    return word;
  }
  import std.container;
  DList!string _nextWords;
}
Input input;
void read(T...)(ref T args)
{
  import std.traits;
  static foreach(i; 0 .. T.length)
    static if(isArray!(T[i]) && !is(T[i] == string))
      foreach(ref e; args[i])
    	read(e);
    else static if(isTuple!(T[i]))
      static foreach(n; 0 .. T[i].Types.length)
	read(args[i][n]);
    else
      args[i] = input.next!(typeof(args[i]))();
}
auto itup(alias k, alias F)()
{
  alias T = Parameters!F;
  foreach(i; 0 .. k)
    {
      T t; get(t);
      F(t);
    }
}
alias get = read;
void wone(T)(T t, char end)
{
  static if(isArray!T && !is(T == string))
    {
      foreach(i; 0 .. t.length - 1)
	  write(t[i], ' ');
      write(t[$ - 1], end);
    }
  else
      write(t, end);
}
void wr(T...)(T t)
{
  static foreach(i; 0 .. T.length)
    static if(i + 1 < T.length)
      wone(t[i], ' ');
    else
      wone(t[i], '\n');
}
void ans(T...)(T t)
{
  import core.stdc.stdlib;
  wr(t);
  exit(0);
}

int main()
{
  int n, m;
  get(n, m);
  int[] trips = new int[n + 1];
  trips[1] = 0;
  foreach(i; iota(2, 1 + n))
      trips[i] = trips[i - 1] + (i - 1) / 2;
  if (m > trips[n])
    ans(-1);
  if (m == trips[n])
    ans(iota(1, 1 + n).array);
  if (m == 0)
    ans(iota(n - 1, 2*n - 1));
  uint k = 0;
  foreach(i, t; trips)
      if (t > m)
	  k = i - 1;
  auto remainingLength = n - k - 1;
  auto startValue = max(2*k + 3 - (m - trips[k]), remainingLength - 1);
  ans(chain(iota(1, 1 + k).array,
	    [2 * k + 1 - 2*(m - trips[k])],
	    iota(startValue, startValue + remainingLength))
      .array);
  assert(0);
}

import std.algorithm;
import std.range;
import std.stdio;
import std.typecons;
import std.traits;
import std.array;
struct Input
{
  T next(T)()
  {
    import std.conv;
    return to!T(nextWord);
  }
  string nextWord()
  {
    if (_nextWords.empty)
	_nextWords.insertFront(readln().split);
    string word = _nextWords.front; _nextWords.removeFront;
    return word;
  }
  import std.container;
  DList!string _nextWords;
}
Input input;
void read(T...)(ref T args)
{
  import std.traits;
  static foreach(i; 0 .. T.length)
    static if(isArray!(T[i]) && !is(T[i] == string))
      foreach(ref e; args[i])
    	read(e);
    else static if(isTuple!(T[i]))
      static foreach(n; 0 .. T[i].Types.length)
	read(args[i][n]);
    else
      args[i] = input.next!(typeof(args[i]))();
}
auto itup(alias k, alias F)()
{
  alias T = Parameters!F;
  foreach(i; 0 .. k)
    {
      T t; get(t);
      F(t);
    }
}
alias get = read;
void wone(T)(T t, char end)
{
  static if(isArray!T && !is(T == string))
    {
      foreach(i; 0 .. t.length - 1)
	  write(t[i], ' ');
      write(t[$ - 1], end);
    }
  else
      write(t, end);
}
void wr(T...)(T t)
{
  static foreach(i; 0 .. T.length)
    static if(i + 1 < T.length)
      wone(t[i], ' ');
    else
      wone(t[i], '\n');
}
void ans(T...)(T t)
{
  import core.stdc.stdlib;
  wr(t);
  exit(0);
}

int main()
{
  int n, m;
  get(n, m);
  int[] trips = new int[n + 1];
  trips[1] = 0;
  foreach(i; iota(2, 1 + n))
      trips[i] = trips[i - 1] + (i - 1) / 2;
  if (m > trips[n])
    ans(-1);
  if (m == trips[n])
    ans(iota(1, 1 + n).array);
  if (m == 0)
    ans(iota(n - 1, 2*n - 1));
  uint k = 0;
  foreach(i, t; trips)
      if (t > m)
	  k = i - 1;
  wr("k", k);
  auto remainingLength = n - k - 1;
  auto startValue = max(2*k + 3 - (m - trips[k]), remainingLength - 1);
  ans(chain(iota(1, 1 + k).array,
	    [2 * k + 1 - 2*(m - trips[k])],
	    iota(startValue, startValue + remainingLength))
      .array);
  assert(0);
}


import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

void main ()
{
	auto tests = readln.strip.to !(int);
	foreach (test; 0..tests)
	{
		auto n = readln.strip.to !(int);
		auto a = readln.splitter.map !(to !(int)).array;
		int lo = int.max;
		int hi = 0;
		bool ok = true;
		foreach (i; 0..n)
		{
			lo = min (lo, a[i] - hi);
			hi = max (hi, a[i] - lo);
			ok &= (lo >= 0 && lo + hi == a[i]);
			debug {writeln (lo, " ", hi, " ", ok);}
		}
		writeln (ok ? "YES" : "NO");
	}
}

import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

//long mod = 10^^9 + 7;
long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto t = RD!int;
	auto ans = new bool[](t);
	foreach (ti; 0..t)
	{
		auto n = RD!int;
		auto a = RDA;

		long x = a[0];
		long y;
		foreach (i; 0..n)
		{
			x.chmin(a[i]);
			auto rem = a[i] - x;
			auto d = rem - y;
			if (d < 0)
			{
				x += d;
			}
			if (x < 0) break;
			a[i] -= x;
			y = a[i];
		}
		x = a[$-1];
		y = 0;
		foreach_reverse (i; 0..n)
		{
			x.chmin(a[i]);
			auto rem = a[i] - x;
			auto d = rem - y;
			if (d < 0)
			{
				x += d;
			}
			if (x < 0) break;
			a[i] -= x;
			y = a[i];
		}
		auto s = a.sum;
		ans[ti] = s == 0;
	}

	foreach (e; ans)
		writeln(e ? "YES" : "NO");
	stdout.flush;
	debug readln;
}

import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }

void main() {
  try {
    for (; ; ) {
      const numCases = readInt();
      foreach (caseId; 0 .. numCases) {
        const N = readInt();
        auto A = new long[N];
        foreach (i; 0 .. N) {
          A[i] = readLong();
        }

        auto ds = new long[N + 1];
        ds[0] = A[0] - 0;
        foreach (i; 1 .. N) {
          ds[i] = A[i] - A[i - 1];
        }
        ds[N] = 0 - A[N - 1];
        debug {
          writeln("ds = ", ds);
        }

        long posi, nega;
        foreach (i; 1 .. N) {
          if (ds[i] > 0) posi += ds[i];
          if (ds[i] < 0) nega += ds[i];
        }

        const ans = (ds[0] >= -nega && -ds[N] >= posi);
        writeln(ans ? "YES" : "NO");
      }
    }
  } catch (EOFException e) {
  }
}

import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

void main ()
{
	auto tests = readln.strip.to !(int);
	foreach (test; 0..tests)
	{
		auto n = readln.strip.to !(int);
		auto a = readln.splitter.map !(to !(int)).array;
		auto b = new int [n];
		foreach (k; 0..2)
		{
			int lo = int.max;
			foreach (i; 0..n)
			{
				lo = min (lo, a[i]);
				b[i] += lo;
			}
			reverse (a);
			reverse (b);
		}
		writeln (n.iota.all !(i => a[i] <= b[i]) ? "YES" : "NO");
	}
}


import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import std.utf;

void main ()
{
	int tests;
	readf !(" %s") (tests);
	foreach (test; 0..tests)
	{
		int n;
		readf !(" %s") (n);
		readln;

		char [] [] s;
		foreach (i; 0..n)
		{
			s ~= readln.strip.dup;
		}

		int res = 0;
		bool [string] vis;
		foreach (ref line; s)
		{
			if (line.idup in vis)
			{
				res += 1;
				line[0] = "0123456789".byChar.find !(c =>
				    s.all !(other => other[0] != c)).front;
			}
			vis[line.idup] = true;
		}
		writeln (res);
		foreach (ref line; s)
		{
			writeln (line);
		}
	}
}

import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * (y / gcd(x, y)); }

//long mod = 10^^9 + 7;
long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto t = RD!int;
	auto ans = new string[][](t);
	auto cnt = new int[](t);
	foreach (i; 0..t)
	{
		auto n = RD!int;
		int[string] set;
		auto str = new string[](n);
		foreach (j; 0..n)
		{
			auto p = RD!string;
			str[j] = p;
			++set[p];
		}
		foreach (j; 0..n)
		{
			if (set[str[j]] == 1)
			{
				continue;
			}

			--set[str[j]];
			++cnt[i];
			(){
			foreach (k; 0..4)
			{
				foreach (num; 0..10)
				{
					auto tmp = str[j].dup;
					tmp[k] = num.to!string[0];
					if (set.get(tmp.idup, 0) == 0)
					{
						str[j] = tmp.idup;
						++set[str[j]];
						return;
					}
				}
			}}();
		}
		ans[i].length = n;
		foreach (j; 0..n)
		{
			ans[i][j] = str[j];
		}
	}

	foreach (i; 0..t)
	{
		writeln(cnt[i]);
		foreach (e; ans[i])
			writeln(e);
	}
	stdout.flush;
	debug readln;
}

import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0;
string rstring(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return rstring.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtypes!real;
T[][] rtypess(T)(int n, int m){ return n.iota.map!(i => rtypes!T(m)).array; } alias rint = rtypess!int, rlong = rtypess!long, rreal = rtypess!real;
T chmin(T)(ref T x, T y){ if(x > y) x = y; return x; } T chmax(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	int t = rint;
	foreach(_; 0 .. t){
		int n = rint;
		string[] ps = rtypes!string(n);
		string[] qs = new string[](n);
		A: foreach(i; 0 .. n){
			foreach(j; 0 .. n) if(ps[i] == qs[j]) continue A;
			qs[i] = ps[i];
		}
		string m = "1234567890";
		foreach(i; 0 .. n){
			if(qs[i] != "") continue;
			string p = ps[i];
			while(1){
				bool f = 0;
				foreach(j; 0 .. n) if(p == qs[j]) f = 1;
				if(f) p = p[0 .. 3] ~ m[p[3] - '0'];
				else break;
			}
			qs[i] = p;
		}
		int cnt;
		foreach(i; 0 .. n) if(ps[i] != qs[i]) cnt += 1;
		cnt.writeln;
		foreach(q; qs) q.writeln;
	}
}

import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main ()
{
	int tests;
	readf !(" %s") (tests);
	foreach (test; 0..tests)
	{
		int n;
		readf !(" %s") (n);
		readln;

		char [] [] s;
		foreach (i; 0..n)
		{
			s ~= readln.strip.dup;
		}

		int res = 0;
		bool [string] vis;
		foreach (ref line; s)
		{
			if (line.idup in vis)
			{
				res += 1;
				do
				{
					int d = line[0] - '0';
					d = (d + 1) % 10;
					line[0] = cast (char) (d + '0');
				}
				while (line in vis);
			}
			vis[line.idup] = true;
		}
		writeln (res);
		foreach (ref line; s)
		{
			writeln (line);
		}
	}
}

import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0;
string rstring(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return rstring.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtypes!real;
T[][] rtypess(T)(int n, int m){ return n.iota.map!(i => rtypes!T(m)).array; } alias rint = rtypess!int, rlong = rtypess!long, rreal = rtypess!real;
T chmin(T)(ref T x, T y){ if(x > y) x = y; return x; } T chmax(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	int t = rint;
	foreach(_; 0 .. t){
		int n = rint;
		string[] ps = rtypes!string(n);
		string[] qs;
		int[string] px;
		bool[string] qset;
		int cnt = 0;
		foreach(int i, p; ps) if(p !in px) px[p] = i;
		foreach(int i, p; ps){
			if(px[p] != i){
				cnt += 1;
				char[] q = p.to!(char[]);
				while(q.to!string in qset) q[3] = '0' + (q[3] - '0' + 1) % 10;
				qset[q.to!string] = 1;
				qs ~= q.to!string;
			}
			else{
				qset[p] = 1;
				qs ~= p;
			}
		}
		cnt.writeln;
		foreach(q; qs) q.writeln;
	}
}

import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0;
string rstring(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return rstring.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtypes!real;
T[][] rtypess(T)(int n, int m){ return n.iota.map!(i => rtypes!T(m)).array; } alias rint = rtypess!int, rlong = rtypess!long, rreal = rtypess!real;
T chmin(T)(ref T x, T y){ if(x > y) x = y; return x; } T chmax(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	int t = rint;
	foreach(_; 0 .. t){
		int n = rint;
		string[] ps = rtypes!string(n);
		string[] qs;
		bool[string] qset;
		int cnt = 0;
		foreach(p; ps){
			char[] q = p.to!(char[]);
			if(q.to!string in qset) cnt += 1;
			while(q.to!string in qset) q[3] = '0' + (q[3] - '0' + 1) % 10;
			qset[q.to!string] = 1;
			qs ~= q.to!string;
		}
		cnt.writeln;
		foreach(q; qs) q.writeln;
	}
}

import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * (y / gcd(x, y)); }

//long mod = 10^^9 + 7;
long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto t = RD!int;
	auto ans = new string[][](t);
	auto cnt = new int[](t);
	foreach (i; 0..t)
	{
		auto n = RD!int;
		int[string] set;
		foreach (j; 0..n)
		{
			auto p = RD!string;
			bool ok = true;
			while (set.get(p, -1) >= 0)
			{
				ok = false;
				p = ((p.to!int+1) % 10000).to!string;
			}
			set[p] = j;
			if (!ok)
				++cnt[i];
		}
		ans[i].length = n;
		foreach (key; set.keys)
		{
			ans[i][set[key]] = key;
		}
	}

	foreach (i; 0..t)
	{
		writeln(cnt[i]);
		foreach (e; ans[i])
			writeln(e);
	}
	stdout.flush;
	debug readln;
}


import std.stdio;
import std.algorithm;
import std.typecons;
import core.memory;
import std.array : uninitializedArray;

immutable long inf = 2 * cast(long) 1e18 + 5;

struct line
{
    long a, b;
    long val(long x)
    {
        return a * x + b;
    }
}

class convex_hull
{
    line[] d;
    size_t ptr = 0;
    bool check(in line i, in line j, in line k)
    {
        return (k.b - i.b) * 1.0L / (i.a - k.a) < (j.b - i.b) * 1.0L / (i.a - j.a);
    }

    ref line opIndex(size_t x)
    {
        return d[x];
    }

    void opOpAssign(string op)(line x)
    {
        if (op == "~")
        {
            if (d.length && d[$ - 1].a == x.a)
            {
                x.b = max(x.b, d[$ - 1].b);
                --d.length;
            }
            d ~= x;
            while (d.length > 2 && check(d[$ - 3], d[$ - 2], d[$ - 1]))
            {
                d[$ - 2] = d[$ - 1];
                --d.length;
            }
        }
    }

    long query(long x)
    {
        if (ptr == d.length)
            return -inf;
        while (ptr + 1 < d.length && d[ptr].val(x) < d[ptr + 1].val(x))
            ++ptr;
        return d[ptr].val(x);
    }
}

class IT
{
    convex_hull[] T;
    this(int size = 0)
    {
        T = new convex_hull[4 * size];
        foreach (ref t; T)
            t = new convex_hull;
    }

    void up(int v, int l, int r, int i, int j, in line val)
    {
        if (l > j || r < i)
            return;
        if (i <= l && r <= j)
        {
            T[v] ~= val;
            return;
        }
        immutable int mid = (l + r) / 2;
        up(2 * v, l, mid, i, j, val);
        up(2 * v + 1, mid + 1, r, i, j, val);
    }

    long get(int v, int l, int r, int pos, in long x)
    {
        if (l > pos || r < pos)
            return -inf;
        if (l == r)
            return T[v].query(x);
        immutable int mid = (l + r) / 2;
        return max(T[v].query(x), get(2 * v, l, mid, pos, x), get(2 * v + 1, mid + 1,
            r, pos, x));
    }
}

IT T;

alias Query = Tuple!(int, "x", int, "st", int, "ed", line, "a", int, "typ");

Query[] Q, Add, Ask;
long[] ans;

int N;

void main()
{
    readf("%d\n", &N);
    Q = uninitializedArray!(Query[])(N);
    T = new IT(N);
    ans = uninitializedArray!(long[])(N);
    foreach (i; 0 .. N)
    {
        auto q = &Q[i];
        readf("%d ", &q.typ);
        if (q.typ == 1)
        {
            readf("%d %d\n", &q.a.a, &q.a.b);
            q.st = i + 1;
            q.ed = N;
        }
        else if (q.typ == 2)
        {
            readf("%d\n", &q.x);
            Q[q.x - 1].ed = i + 1;
        }
        else
        {
            readf("%d\n", &q.x);
            q.st = i + 1;
            Ask ~= *q;
        }
    }
    foreach (ref q; Q)
        if (q.typ == 1)
            Add ~= q;
    sort!`a.a.a < b.a.a`(Add);
    foreach (ref q; Add)
        T.up(1, 1, N, q.st, q.ed, q.a);
    sort!`a.x < b.x`(Ask);
    foreach (ref q; Ask)
        ans[q.st - 1] = T.get(1, 1, N, q.st, q.x);
    foreach (i; 0 .. N)
        if (Q[i].typ == 3)
        {
            if (ans[i] == -inf)
                writef("EMPTY SET\n");
            else
                writef("%d\n", ans[i]);
        }
}

import std.stdio;
import std.algorithm;
import std.typecons;
import core.memory;
import std.array : uninitializedArray;

immutable long inf = 2 * cast(long) 1e18 + 5;

struct line
{
    long a, b;
    long val(long x)
    {
        return a * x + b;
    }
}

class convex_hull
{
    line[] d;
    size_t ptr = 0;
    bool check(in line i, in line j, in line k)
    {
        return (k.b - i.b) * 1.0L / (i.a - k.a) < (j.b - i.b) * 1.0L / (i.a - j.a);
    }

    ref line opIndex(size_t x)
    {
        return d[x];
    }

    void opOpAssign(string op)(line x)
    {
        if (op == "~")
        {
            if (d.length && d[$ - 1].a == x.a)
            {
                x.b = max(x.b, d[$ - 1].b);
                --d.length;
            }
            d ~= x;
            while (d.length > 2 && check(d[$ - 3], d[$ - 2], d[$ - 1]))
            {
                d[$ - 2] = d[$ - 1];
                --d.length;
            }
        }
    }

    long query(long x)
    {
        if (ptr == d.length)
            return -inf;
        while (ptr + 1 < d.length && d[ptr].val(x) < d[ptr + 1].val(x))
            ++ptr;
        return d[ptr].val(x);
    }
}

class IT
{
    convex_hull[] T;
    this(int size = 0)
    {
        T = new convex_hull[4 * size];
        foreach (i; 0..4 * size)
						T[i] = new convex_hull;
    }

    void up(int v, int l, int r, int i, int j, in line val)
    {
        if (l > j || r < i)
            return;
        if (i <= l && r <= j)
        {
            T[v] ~= val;
            return;
        }
        immutable int mid = (l + r) / 2;
        up(2 * v, l, mid, i, j, val);
        up(2 * v + 1, mid + 1, r, i, j, val);
    }

    long get(int v, int l, int r, int pos, in long x)
    {
        if (l > pos || r < pos)
            return -inf;
        if (l == r)
            return T[v].query(x);
        immutable int mid = (l + r) / 2;
        return max(T[v].query(x), get(2 * v, l, mid, pos, x), get(2 * v + 1, mid + 1,
            r, pos, x));
    }
}

IT T;

alias Query = Tuple!(int, "x", int, "st", int, "ed", line, "a", int, "typ");

Query[] Q, Add, Ask;
long[] ans;

int N;

void main()
{
    readf("%d\n", &N);
    Q = uninitializedArray!(Query[])(N);
    T = new IT(N);
    ans = uninitializedArray!(long[])(N);
    foreach (i; 0 .. N)
    {
        auto q = &Q[i];
        readf("%d ", &q.typ);
        if (q.typ == 1)
        {
            readf("%d %d\n", &q.a.a, &q.a.b);
            q.st = i + 1;
            q.ed = N;
        }
        else if (q.typ == 2)
        {
            readf("%d\n", &q.x);
            Q[q.x - 1].ed = i + 1;
        }
        else
        {
            readf("%d\n", &q.x);
            q.st = i + 1;
            Ask ~= *q;
        }
    }
    for (int i = 0; i < N; ++i)
        if (Q[i].typ == 1)
            Add ~= Q[i];
    sort!`a.a.a < b.a.a`(Add);
    for (int i = 0; i < Add.length; ++i)
        T.up(1, 1, N, Add[i].st, Add[i].ed, Add[i].a);
    sort!`a.x < b.x`(Ask);
    for (int i = 0; i < Ask.length; ++i)
				ans[Ask[i].st - 1] = T.get(1, 1, N, Ask[i].st, Ask[i].x);
    foreach (i; 0 .. N)
        if (Q[i].typ == 3)
        {
            if (ans[i] == -inf)
                writef("EMPTY SET\n");
            else
                writef("%d\n", ans[i]);
        }
}

import std.stdio;
import std.algorithm;
import std.typecons;

immutable long inf = 2 * cast(long) 1e18 + 5;

struct line
{
    long a, b;
    long val(long x)
    {
        return a * x + b;
    }
}

class convex_hull
{
    line[] d;
    size_t ptr = 0;
    bool check(in line i, in line j, in line k)
    {
        return (k.b - i.b) * 1.0L / (i.a - k.a) < (j.b - i.b) * 1.0L / (i.a - j.a);
    }

    ref line opIndex(size_t x)
    {
        return d[x];
    }

    void opOpAssign(string op)(line x)
    {
        if (op == "~")
        {
            if (d.length && d[$ - 1].a == x.a)
            {
                x.b = max(x.b, d[$ - 1].b);
                --d.length;
            }
            d ~= x;
            while (d.length > 2 && check(d[$ - 3], d[$ - 2], d[$ - 1]))
            {
                d[$ - 2] = d[$ - 1];
                --d.length;
            }
        }
    }

    long query(long x)
    {
        if (ptr == d.length)
            return -inf;
        while (ptr + 1 < d.length && d[ptr].val(x) < d[ptr + 1].val(x))
            ++ptr;
        return d[ptr].val(x);
    }
}

class IT
{
    convex_hull[] T;
    this(int size = 0)
    {
        T = new convex_hull[4 * size];
        foreach (ref t; T)
            t = new convex_hull;
    }

    void up(int v, int l, int r, int i, int j, in line val)
    {
        if (l > j || r < i)
            return;
        if (i <= l && r <= j)
        {
            T[v] ~= val;
            return;
        }
        immutable int mid = (l + r) / 2;
        up(2 * v, l, mid, i, j, val);
        up(2 * v + 1, mid + 1, r, i, j, val);
    }

    long get(int v, int l, int r, int pos, in long x)
    {
        if (l > pos || r < pos)
            return -inf;
        if (l == r)
            return T[v].query(x);
        immutable int mid = (l + r) / 2;
        return max(T[v].query(x), get(2 * v, l, mid, pos, x), get(2 * v + 1, mid + 1,
            r, pos, x));
    }
}

IT T;

struct Query
{
    int typ, x, st, ed;
    line a;
}

Query[] Q, Add, Ask;
long[] ans;

int N;

void main()
{
    readf("%d\n", &N);
    Q = new Query[N];
    T = new IT(N);
    ans = new long[N];
    foreach (i; 0 .. N)
    {
        auto q = &Q[i];
        readf("%d ", &q.typ);
        if (q.typ == 1)
        {
            readf("%d %d\n", &q.a.a, &q.a.b);
            q.st = i + 1;
            q.ed = N;
        }
        else if (q.typ == 2)
        {
            readf("%d\n", &q.x);
            Q[q.x - 1].ed = i + 1;
        }
        else
        {
            readf("%d\n", &q.x);
            q.st = i + 1;
            Ask ~= *q;
        }
    }
    foreach (ref q; Q)
        if (q.typ == 1)
            Add ~= q;
    sort!`a.a.a < b.a.a`(Add);
    foreach (ref q; Add)
        T.up(1, 1, N, q.st, q.ed, q.a);
    sort!`a.x < b.x`(Ask);
    foreach (ref q; Ask)
        ans[q.st - 1] = T.get(1, 1, N, q.st, q.x);
    foreach (i; 0 .. N)
        if (Q[i].typ == 3)
        {
            if (ans[i] == -inf)
                writeln("EMPTY SET");
            else
                writeln(ans[i]);
        }
}

import std.stdio;
import std.algorithm;
import std.typecons;

immutable long inf = 2 * cast(long) 1e18 + 5;

struct line
{
    long a, b;
    long val(long x)
    {
        return a * x + b;
    }
}

class convex_hull
{
    line[] d;
    size_t ptr = 0;
    bool check(in line i, in line j, in line k)
    {
        return (k.b - i.b) * 1.0L / (i.a - k.a) < (j.b - i.b) * 1.0L / (i.a - j.a);
    }

    ref line opIndex(size_t x)
    {
        return d[x];
    }

    void opOpAssign(string op)(line x)
    {
        if (op == "~")
        {
            if (d.length && d[$ - 1].a == x.a)
            {
                x.b = max(x.b, d[$ - 1].b);
                --d.length;
            }
            d ~= x;
            while (d.length > 2 && check(d[$ - 3], d[$ - 2], d[$ - 1]))
            {
                d[$ - 2] = d[$ - 1];
                --d.length;
            }
        }
    }

    long query(long x)
    {
        if (ptr == d.length)
            return -inf;
        while (ptr + 1 < d.length && d[ptr].val(x) < d[ptr + 1].val(x))
            ++ptr;
        return d[ptr].val(x);
    }
}

class IT
{
    convex_hull[] T;
    this(int size = 0)
    {
        T = new convex_hull[4 * size];
        foreach (ref t; T)
            t = new convex_hull;
    }

    void up(int v, int l, int r, int i, int j, in line val)
    {
        if (l > j || r < i)
            return;
        if (i <= l && r <= j)
        {
            T[v] ~= val;
            return;
        }
        immutable int mid = (l + r) / 2;
        up(2 * v, l, mid, i, j, val);
        up(2 * v + 1, mid + 1, r, i, j, val);
    }

    long get(int v, int l, int r, int pos, in long x)
    {
        if (l > pos || r < pos)
            return -inf;
        if (l == r)
            return T[v].query(x);
        immutable int mid = (l + r) / 2;
        return max(T[v].query(x), get(2 * v, l, mid, pos, x), get(2 * v + 1, mid + 1,
            r, pos, x));
    }
}

IT T;

struct Query
{
    int typ, x, st, ed;
    line a;
}

Query[] Q, Add, Ask;
long[] ans;

int N;

void main()
{
    readf("%d\n", &N);
    Q = new Query[N];
    T = new IT(N);
    ans = new long[N];
    foreach (i; 0 .. N)
    {
        auto q = &Q[i];
        readf("%d ", &q.typ);
        if (q.typ == 1)
        {
            readf("%d %d\n", &q.a.a, &q.a.b);
            q.st = i + 1;
            q.ed = N;
        }
        else if (q.typ == 2)
        {
            readf("%d\n", &q.x);
            Q[q.x - 1].ed = i + 1;
        }
        else
        {
            readf("%d\n", &q.x);
            q.st = i + 1;
            Ask ~= *q;
        }
    }
    foreach (ref q; Q)
        if (q.typ == 1)
            Add ~= q;
    sort!`a.a.a < b.a.a`(Add);
    foreach (ref q; Add)
        T.up(1, 1, N, q.st, q.ed, q.a);
    sort!`a.x < b.x`(Ask);
    foreach (ref q; Ask)
        ans[q.st - 1] = T.get(1, 1, N, q.st, q.x);
    foreach (i; 0 .. N)
        if (Q[i].typ == 3)
        {
            if (ans[i] == -inf)
                writef("EMPTY SET\n");
            else
                writef("%d\n", ans[i]);
        }
}

import std.stdio;
import std.algorithm;
import std.typecons;
import core.memory;
import std.container.array : Array;

immutable long inf = 2 * cast(long) 1e18 + 5;

struct line
{
    long a, b;
    long val(long x)
    {
        return a * x + b;
    }
}

class convex_hull
{
    line[] d;
    size_t ptr = 0;
    bool check(in line i, in line j, in line k)
    {
        return (k.b - i.b) * 1.0L / (i.a - k.a) < (j.b - i.b) * 1.0L / (i.a - j.a);
    }

    ref line opIndex(size_t x)
    {
        return d[x];
    }

    void opOpAssign(string op)(line x)
    {
        if (op == "~")
        {
            if (d.length && d[$ - 1].a == x.a)
            {
                x.b = max(x.b, d[$ - 1].b);
                --d.length;
            }
            d ~= x;
            while (d.length > 2 && check(d[$ - 3], d[$ - 2], d[$ - 1]))
            {
                d[$ - 2] = d[$ - 1];
                --d.length;
            }
        }
    }

    long query(long x)
    {
        if (ptr == d.length)
            return -inf;
        while (ptr + 1 < d.length && d[ptr].val(x) < d[ptr + 1].val(x))
            ++ptr;
        return d[ptr].val(x);
    }
}

class IT
{
    convex_hull[] T;
    this(int size = 0)
    {
        T = new convex_hull[4 * size];
        foreach (ref t; T)
            t = new convex_hull;
    }

    void up(int v, int l, int r, int i, int j, in line val)
    {
        if (l > j || r < i)
            return;
        if (i <= l && r <= j)
        {
            T[v] ~= val;
            return;
        }
        immutable int mid = (l + r) / 2;
        up(2 * v, l, mid, i, j, val);
        up(2 * v + 1, mid + 1, r, i, j, val);
    }

    long get(int v, int l, int r, int pos, in long x)
    {
        if (l > pos || r < pos)
            return -inf;
        if (l == r)
            return T[v].query(x);
        immutable int mid = (l + r) / 2;
        return max(T[v].query(x), get(2 * v, l, mid, pos, x), get(2 * v + 1, mid + 1,
            r, pos, x));
    }
}

IT T;

alias Query = Tuple!(int, "x", int, "st", int, "ed", line, "a", int, "typ");

Query[] Q, Add, Ask;
long[] ans;

int N;

void main()
{
    readf("%d\n", &N);
    Q = new Query[N];
    T = new IT(N);
    ans = new long[N];
    foreach (i; 0 .. N)
    {
        auto q = &Q[i];
        readf("%d ", &q.typ);
        if (q.typ == 1)
        {
            readf("%d %d\n", &q.a.a, &q.a.b);
            q.st = i + 1;
            q.ed = N;
        }
        else if (q.typ == 2)
        {
            readf("%d\n", &q.x);
            Q[q.x - 1].ed = i + 1;
        }
        else
        {
            readf("%d\n", &q.x);
            q.st = i + 1;
            Ask ~= *q;
        }
    }
    foreach (ref q; Q)
        if (q.typ == 1)
            Add ~= q;
    sort!`a.a.a < b.a.a`(Add);
    foreach (ref q; Add)
        T.up(1, 1, N, q.st, q.ed, q.a);
    sort!`a.x < b.x`(Ask);
    foreach (ref q; Ask)
        ans[q.st - 1] = T.get(1, 1, N, q.st, q.x);
    foreach (i; 0 .. N)
        if (Q[i].typ == 3)
        {
            if (ans[i] == -inf)
                writef("EMPTY SET\n");
            else
                writef("%d\n", ans[i]);
        }
}

import std.stdio;
import std.algorithm;
import std.typecons;

immutable long inf = 2 * cast(long) 1e18 + 5;

struct line
{
    long a, b;
    long val(long x)
    {
        return a * x + b;
    }
}

class convex_hull
{
    line[] d;
    size_t ptr = 0;
    bool check(in line i, in line j, in line k)
    {
        return (k.b - i.b) * 1.0L / (i.a - k.a) < (j.b - i.b) * 1.0L / (i.a - j.a);
    }

    ref line opIndex(size_t x)
    {
        return d[x];
    }

    void opOpAssign(string op)(line x)
    {
        if (op == "~")
        {
            if (d.length && d[$ - 1].a == x.a)
            {
                x.b = max(x.b, d[$ - 1].b);
                --d.length;
            }
            d ~= x;
            while (d.length > 2 && check(d[$ - 3], d[$ - 2], d[$ - 1]))
            {
                writeln(d.length);
                d[$ - 2] = d[$ - 1];
                --d.length;
            }
        }
    }

    long query(long x)
    {
        if (ptr == d.length)
            return -inf;
        while (ptr + 1 < d.length && d[ptr].val(x) < d[ptr + 1].val(x))
            ++ptr;
        return d[ptr].val(x);
    }
}

class IT
{
    convex_hull[] T;
    this(int size = 0)
    {
        T = new convex_hull[4 * size];
        foreach (ref t; T)
            t = new convex_hull;
    }

    void up(int v, int l, int r, int i, int j, in line val)
    {
        if (l > j || r < i)
            return;
        if (i <= l && r <= j)
        {
            T[v] ~= val;
            return;
        }
        immutable int mid = (l + r) / 2;
        up(2 * v, l, mid, i, j, val);
        up(2 * v + 1, mid + 1, r, i, j, val);
    }

    long get(int v, int l, int r, int pos, in long x)
    {
        if (l > pos || r < pos)
            return -inf;
        if (l == r)
            return T[v].query(x);
        immutable int mid = (l + r) / 2;
        return max(T[v].query(x), get(2 * v, l, mid, pos, x), get(2 * v + 1, mid + 1,
            r, pos, x));
    }
}

IT T;

struct Query
{
    int typ, x, st, ed;
    line a;
}

Query[] Q, Add, Ask;
long[] ans;

int N;

void main()
{
    readf("%d\n", &N);
    Q = new Query[N];
    T = new IT(N);
    ans = new long[N];
    foreach (i; 0 .. N)
    {
        auto q = &Q[i];
        readf("%d ", &q.typ);
        if (q.typ == 1)
        {
            readf("%d %d\n", &q.a.a, &q.a.b);
            q.st = i + 1;
            q.ed = N;
        }
        else if (q.typ == 2)
        {
            readf("%d\n", &q.x);
            Q[q.x - 1].ed = i + 1;
        }
        else
        {
            readf("%d\n", &q.x);
            q.st = i + 1;
            Ask ~= *q;
        }
    }
    foreach (ref q; Q)
        if (q.typ == 1)
            Add ~= q;
    sort!`a.a.a < b.a.a`(Add);
    foreach (ref q; Add)
        T.up(1, 1, N, q.st, q.ed, q.a);
    sort!`a.x < b.x`(Ask);
    foreach (ref q; Ask)
        ans[q.st - 1] = T.get(1, 1, N, q.st, q.x);
    foreach (i; 0 .. N)
        if (Q[i].typ == 3)
        {
            if (ans[i] == -inf)
                writeln("EMPTY SET");
            else
                writeln(ans[i]);
        }
}


import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { x.modm(y.modpow(mod - 2)); }

void main()
{
	auto n = RD!int;
	auto b = RDA;
	auto a = new long[](n);
	auto c = new long[](n);
	long last;
	foreach (i; 0..n)
	{
		a[i] = b[i] + last;
		last.chmax(a[i]);
		if (a[i] < 0)
		{
			c[i] = abs(a[i]);
			last += c[i];
		}
	}
	long add;
	foreach_reverse (i; 0..n)
	{
		a[i] += add;
		if (c[i] > 0)
		{
			add = c[i];
		}
	}

	a.map!(to!string).join(" ").writeln;
	stdout.flush;
	debug readln;
}

import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main ()
{
	int n;
	while (readf !(" %s") (n) > 0)
	{
		readln;
		auto b = readln.splitter.map !(to !(long)).array;
		long m = 0;
		long [] a;
		foreach (ref c; b)
		{
			a ~= c + m;
			m = max (m, a.back);
		}
		writefln !("%(%s %)") (a);
	}
}

import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); } bool DEBUG = 0;
void log(A ...)(lazy A a){ if(DEBUG) print(a); }
void print(){ writeln(""); } void print(T)(T t){ writeln(t); } void print(T, A ...)(T t, A a){ write(t, " "), print(a); }
string unsplit(T)(T xs){ return xs.array.to!(string[]).join(" "); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; } T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
T lowerTo(T)(ref T x, T y){ if(x > y) x = y; return x; } T raiseTo(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
    int n = scan!int;
    long[] bs = scan!long(n);

    long x = 0;
    long[] as;
    foreach(i; 0 .. n){
        as ~= x + bs[i];
        x.raiseTo(as[i]);
    }
    as.unsplit.print;
}

import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }

void main() {
  try {
    for (; ; ) {
      const N = readInt();
      auto B = new long[N];
      foreach (i; 0 .. N) {
        B[i] = readLong();
      }

      auto as = new long[N];
      auto xs = new long[N + 1];
      xs[0] = 0;
      foreach (i; 0 .. N) {
        // b = a - x
        as[i] = B[i] + xs[i];
        xs[i + 1] = max(xs[i], as[i]);
      }
      foreach (i; 0 .. N) {
        if (i > 0) write(" ");
        write(as[i]);
      }
      writeln();
    }
  } catch (EOFException e) {
  }
}


import std.algorithm;
import std.stdio;

immutable int MAX_C = 10_005;

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		auto a = new int [n];
		foreach (ref x; a)
		{
			readf (" %s", &x);
		}

		int res = MAX_C * MAX_C;
		foreach (i; 1..min (MAX_C, n))
		{
			int add = i;
			add *= add;
			int cur = 0;
			foreach (j; 1..n)
			{
				cur += a[j];
				if (j > i)
				{
					cur -= a[j - i];
				}
				if (-MAX_C <= cur && cur <= MAX_C)
				{
					res = min (res, cur * cur + add);
				}
			}
		}

		writeln (res);
	}
}

import std.algorithm, std.math, std.stdio;
void main () {
	int n;
	readf (" %s", &n);
	auto a = new int [n];
	foreach (ref x; a) readf (" %s", &x);
	long r = long.max;
	foreach (i; 1..1111) {
		long c = 0;
		foreach (j; 1..n) {
			c += a[j];
			if (j > i) c -= a[j - i];
			r = min (r, c * c + i * i);
		}
	}
	writeln (r);
}

import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.exception;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import core.bitop;

int MAX_C = 10_005;

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		auto a = new int [n];
		foreach (ref x; a)
		{
			readf (" %s", &x);
		}

		int res = MAX_C;
		foreach (i; 1..min (MAX_C, n))
		{
			int add = i;
			add *= add;
			int cur = 0;
			foreach (j; 1..n)
			{
				cur += a[j];
				if (j > i)
				{
					cur -= a[j - i];
				}
				if (cur <= MAX_C)
				{
					res = min (res, cur * cur + add);
				}
			}
		}

		writeln (res);
	}
}


import std.stdio;
int main()
{
	float a=0;
	readf(" %f", &a);
	float sum=0;
	for (int i=0; i<a; i++)
	{
		float b=0;
		readf(" %f", &b);
		sum=sum+b;
	}
	writeln(sum/a);
	return 0;
}

import std.stdio;
import core.stdc.stdio;
import std.algorithm;
import std.math;

int main(string[] argv)
{
	int n;
	int[] oj;
	scanf("%d", &n); oj.length = n;
	long sum;
	foreach (int i; 0..n)
	{
		scanf("%d", &oj[i]);
		sum += oj[i];
	}
	printf("%.10f", cast(float)sum / cast(float)n);
	return 0;
}

import std.stdio;
import std.array;
import std.range;
import std.algorithm;
import std.math;
import std.string;
import std.conv;

void main() {
	readln();
	auto arr = readln().chomp.split(" ").map!(to!int).array;
	writeln(arr.reduce!((a, b) => a + b) / cast(double) arr.length);
}

import std.stdio;
import std.string;
import std.conv;
import std.regex;
import std.algorithm.iteration;
import  std.array;

void main()
{
  stdin.readln;
  auto ps = stdin.readln.strip.split(regex(` +`)).map!(to!double)
    .map!"a/100".array;
  writef("%.9f",ps.sum/ps.length*100);
}


import std.stdio, std.range, std.algorithm, std.conv, std.typecons, std.container, std.string, std.math;

void main() {
  int n = readln.strip.to!int;
  int[] a = readln.strip.split.map!(to!int).array;
  writeln(abs(a[0]-a[1]), " ", abs(a[0]-a[n-1]));
  foreach (i; 1..n-1) {
    auto mn = min(abs(a[i]-a[i-1]), abs(a[i]-a[i+1]));
    auto mx = max(abs(a[i]-a[0]), abs(a[i]-a[n-1]));
    writeln(mn, " ", mx);
  }
  writeln(abs(a[n-1]-a[n-2]), " ", abs(a[0]-a[n-1]));
}

import std.stdio;
import std.c.stdio;
import std.math;
import std.algorithm;
import std.conv;
import std.string;
import std.array;
import std.typecons;

void main() {
  int n = readln().strip().to!int;
  int[] a = readln().split().map!(to!int).array;
  writeln(a[1] - a[0], ' ', a[n - 1] - a[0]);
  foreach (i; 1..n-1) {
    writeln(min(a[i] - a[i - 1], a[i + 1] - a[i]), ' ',
            max(a[i] - a[0], a[n - 1] - a[i]));
  }
  writeln(a[n - 1] - a[n - 2], ' ', a[n - 1] - a[0]);
}


import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;
    auto G = new int[][](N);
    foreach (_; 0..N-1) {
        auto s = readln.split.map!(to!int);
        G[s[0]-1] ~= s[1]-1;
        G[s[1]-1] ~= s[0]-1;
    }

    auto f = new long[](N);
    auto g = new long[](N);
    auto h = new long[](N);
    auto k = new long[](N);

    void dfs1(int n, int p) {
        foreach (m; G[n]) {
            if (m == p) continue;
            dfs1(m, n);
            g[n] += g[m] + A[m];
            f[n] += f[m] + g[m] + A[m];
        }
    }

    void dfs2(int n, int p) {
        if (p == -1) {
            h[n] = f[n];
            k[n] = g[n];
        } else {
            /*
            long fp = h[p] - f[n] - g[n] - A[n];
            long gp = k[p] - g[n] - A[n];
            h[n] = fp + gp + A[p];
            k[n] = gp + A[p];
            */
            h[n] = h[p] + k[p] + A[p] - (A[n] + g[n]) * 2;
            k[n] = k[p] + A[p] - A[n];
        }
        foreach (m; G[n]) if (m != p) dfs2(m, n);
    }

    dfs1(0, -1);
    dfs2(0, -1);
    h.reduce!max.writeln;
}

import std.stdio;
import std.uni;
import std.conv;
import std.container;
import std.functional;
import std.algorithm;
import std.array;
import std.typecons;
import std.range;
import std.numeric;
import std.traits;

void main(string[] args)
{
  auto n = next!int;
  auto a = next!long(n);
  auto adjlist = new int[][](n);
  foreach(i; 0 .. n - 1)
    {
      auto u = next!int - 1;
      auto v = next!int - 1;
      adjlist[u] ~= v;
      adjlist[v] ~= u;
    }
  auto aSum = new long[](n);
  auto treeCost = new long[](n);
  void dfs1(int v, int p)
  {
    aSum[v] = a[v];
    treeCost[v] = 0;
    foreach(w; adjlist[v])
      if (w != p)
	{
	  dfs1(w, v);
	  treeCost[v] += treeCost[w] + aSum[w];
	  aSum[v] += aSum[w];
	}
  }
  dfs1(0, -1);
  long maxCost = long.min;
  void dfs2(int v, int p, long parentCost)
  {
    auto cost = treeCost[v] + parentCost;
    maxCost = max(maxCost, cost);
    foreach(w; adjlist[v])
      if (w != p)
	{
	  dfs2(w, v, cost - treeCost[w] - aSum[w] + aSum[0] - aSum[w]);
	}
  }
  dfs2(0, -1, 0);
  maxCost.writeln;
}

static this()
{
  popChar;
}

struct Any(T)
{
  static auto read()
  {
    static if (is(T == char))
      {
	auto res = frontChar;
	popChar;
	return res;
      }
  }
}

struct Unsigned(T)
{
  auto read()
  {
    auto res = T(0);
    while(!frontChar.isDigit) popChar;
    do
      {
	res = res * T(10) + T(frontChar - '0');
	popChar;
      }
    while(frontChar.isDigit);
    return res;
  }
}

struct Matrix(T, alias rows, alias cols)
{
  T[][] _cell;
  alias _cell this;
  // Ring constructor
  this(int n)
  {
    final switch(n)
      {
      case 0:
	_cell = new T[][](rows, cols);
	break;
      case 1:
	debug assert(rows == cols);
	_cell = new T[][](rows, cols);
	foreach(i; 0 .. rows)
	  _cell[i][i] = T(1);
	break;
      }
  }
  // Copy constructor
  this(Matrix!(T, rows, cols) other)
  {
    _cell = new T[][](rows, cols);
    foreach(i; 0 .. rows)
      _cell[i][] = other[i][];
  }
  auto opBinary(string op)(Matrix!(T, rows, cols) other)
       if (op == "+" || op == "-")
	 {
	   auto res = Matrix!(T, rows, cols)(0);
	   foreach(i; 0 .. rows)
	     foreach(j; 0 .. cols)
	       res[i][j] = mixin(q{this[i][j]}, op, q{other[i][j]});
	   return res;
	 }
  auto opBinary(string op, alias otherRows, alias otherCols)(Matrix!(T, otherRows, otherCols) other)
       if (op == "*")
	 {
	   debug assert(cols == otherRows);
	   auto res = Matrix!(T, rows, otherCols)(0);
	   foreach(i; 0 .. rows)
	     foreach(k; 0 .. cols)
	       foreach(j; 0 .. otherCols)
		 res[i][j] += this[i][k] * other[k][j];
	   return res;
	 }
  ref auto opOpAssign(string op)(Matrix!(T, rows, cols) other)
  {
    static if (op == "*")
      {
	debug assert(rows == cols);
	alias n = rows;
	auto res = Matrix!(T, n, n)(0);
	T factor;
	foreach(i; 0 .. n)
	  foreach(k; 0 .. n)
	    foreach(j; 0 .. n)
	      res[i][j] += this[i][k] * other[k][j];
	foreach(i; 0 .. n)
	  this[i][] = res[i][];
      }
    else
      {
	foreach(i; 0 .. rows)
	  foreach(j; 0 .. cols)
	    mixin(q{this[i][j] }, text(op, q{=}), q{ other[i][j];});
      }
    return this;
  }
  mixin powMethod;
}

struct Mod(T, alias mod)
{
  alias This = Mod!(T, mod);
  T _rep;
  this(T t)
  {
    _rep = t % mod;
    if (_rep < 0) _rep += mod;
  }
  static auto plain(T t)
  {
    auto res = Mod!(T, mod)();
    res._rep = t;
    return res;
  }
  static auto fromPositive(T t)
  {
    pragma(inline, true);
    return Mod!(T, mod).plain(t % mod);
  }
  static auto fromNegative(T t)
  {
    pragma(inline, true);
    return Mod!(T, mod).plain(t % mod + mod);
  }
  string toString()
  {
    return to!string(_rep);
  }
  debug invariant
  {
    assert(_rep >= 0 && _rep < mod);
  }
  auto opBinary(string op)(This b)
  {
    static if (op == "+")
      {
	T resrep = _rep + b._rep;
	if (resrep >= mod) resrep -= mod;
	return This.plain(resrep);
      }
    else static if (op == "-")
      {
	T resrep = _rep - b._rep;
	if (resrep < 0) resrep += mod;
	return This.plain(resrep);
      }
    else static if (op == "*")
      {
	return This.fromPositive(_rep * b._rep);
      }
  }
  auto opOpAssign(string op)(This b)
  {
    mixin(q{_rep }, text(op, "="), q{b._rep;});
    static if (op == "+")
      {
	if (_rep >= mod) _rep -= mod;
      }
    else static if (op == "-")
      {
	if (_rep < 0) _rep += mod;
      }
    else static if (op == "*")
      {
	_rep %= mod;
      }
    return this;
  }

  auto opBinary(string op)(long exp)
       if (op == "^^")
	 {
	   return pow(exp);
	 }
  mixin powMethod;
}

mixin template powMethod()
{
  auto pow(this ThisType)(long exp)
    {
      auto res = ThisType(1);
      auto pow = ThisType(this);
      while(exp)
	{
	  if (exp & 1) res *= pow;
	  pow *= pow;
	  exp >>= 1;
	}
      return res;
    }
}
// INPUT
char frontChar;
void popChar()
{
  import core.stdc.stdio;
  frontChar = cast(char) getchar;
  if (feof(stdin)) frontChar = ' ';
}
auto makeArray(T, S...)(S s)
{
  enum brackets = () {
    string res;
    foreach(i; 0 .. s.length)
      res ~= "[]";
    return res;
  } ();
  mixin(q{alias Type = T}, brackets, q{;});
  return new Type(s);
}
template isNumberLike(T)
{
  enum isNumberLike = is(typeof((){T test; test = test + test * test; test *= test;}()));
}
void popWhite()
{
  import std.ascii;
  while (frontChar.isWhite) popChar;
}
void print(T...)(T t)
{
  static foreach(ti; t)
    {
      static if (is(typeof(ti) == string))
	{
	  write(ti, " ");
	}
      else static if (isArray!(typeof(ti)))
	{
	  foreach(e; ti) print(e);
	}
      else static if (isTuple!(typeof(ti)))
	{
	  static foreach(i; ti.length) writesp(ti[i]);
	}
      else
	{
	  write(ti, " ");
	}
    }
}
void println(T...)(T t)
{
  static if (t.length == 0)
    writeln;
  static foreach(ti; t)
    {
      print(ti);
      writeln;
    }
}
auto next(alias T, S...)(S s)
{
  pragma(inline, true);
  static if (s.length > 0)
    {
      auto res = makeArray!(typeof(next!T()))(s);
      S t;
      enum loops = () {
	string res;
	foreach(i; 0 .. s.length)
	  {
	    auto ti = text(q{t[}, i, q{]});
	    res ~= text(q{for(}, ti, q{ = 0;}, ti , q{ < s[}, i, q{];}, ti, q{++)});
	  }
	return res;
      } ();
      enum indexing = () {
	string res = "res";
	foreach(i; 0 .. s.length)
	  res ~= text(q{[t[}, i, q{]]});
	return res;
      } ();
      mixin(loops, indexing, q{ = next!T;});
      return res;
    }
  else
    {
      static if (isNumberLike!T)
	{
	  import std.ascii: isDigit;
	  T res;
	  while(frontChar.isWhite) popChar;
	  T multiplier = T(1);
	  if (frontChar == '-')
	    {
	      multiplier = T(-1);
	      popChar;
	    }
	  else if (frontChar == '+')
	    {
	      popChar;
	    }
	  debug assert(frontChar.isDigit);
	  do
	    {
	      res = res * T(10) + T(frontChar - '0');
	      popChar;
	    }
	  while(frontChar.isDigit);
	  return multiplier * res;
	}
      else static if (is(T == string))
	{
	  import std.ascii: isWhite;
	  string res;
	  while(frontChar.isWhite)
	    popChar;
	  while(!frontChar.isWhite)
	    {
	      res ~= frontChar;
	      popChar;
	    }
	  return res;
	}
      else static if (is(T == char))
	{
	  while(frontChar.isWhite) popChar;
	  auto res = frontChar;
	  popChar;
	  return res;
	}
      else
	{
	  return T.read;
	}
    }
}