#nullable enable using System.Numerics; const int Mod = 100000000; const int n = 50; const int l = (n * (n + 1)) >> 1; const int cc = 50; var random = new Random(1); const int tl = 1700; var sw = new System.Diagnostics.Stopwatch(); bool TL() => sw.ElapsedMilliseconds < tl; void Run() { Int(); var py = (stackalloc int[l]); { var k = 0; for (var i = 0; i < n; i++) for (var j = 0; j <= i; j++) py[k++] = Int(); } sw.Start(); static int I(int i, int j) => ((i * (i + 1)) >> 1) + j; static int AV(int i, int j, Span py) => py[I(i, j)]; var qy = (stackalloc int[cc * l]); for (var i = 0; i < qy.Length; i++) qy[i] = random.Next(Mod); static int E(int c, Span py, Span sy) { var ge = -1; for (var i = 0; i < n; i++) for (var j = 0; j <= i; j++) { var d = Math.Abs(AV(i, j, py) - sy[I(i, j)]); var e = Math.Min(d, Mod - d); if (e > ge) ge = e; } return ge; } static void TryC(int c, Random random, Span py, Span qy) { var li = l * c; var oy = (stackalloc int[l]); qy.Slice(li, l).CopyTo(oy); var ny = (stackalloc int[l]); oy.CopyTo(ny); var ge = E(c, py, oy); var i = random.Next(n); var r = random.Next(ge) - (ge >> 1); if (r >= 0) r++; ny[l - n + i] += r; if (ny[l - n + i] >= Mod) ny[l - n + i] -= Mod; if (ny[l - n + i] < 0) ny[l - n + i] += Mod; var cl = i; var cr = i + 1; for (var level = n - 2; level >= 0; level--) { cl = Math.Max(0, cl - 1); cr = Math.Min(level + 1, cr + 1); for (var j = cl; j < cr; j++) { var di = I(level + 1, j); var nv = (ny[di] + ny[di + 1]) % Mod; ny[I(level, j)] = nv; } } var ne = E(c, py, ny); if (ne < ge) for (var j = 0; j < l; j++) qy[li++] = ny[j]; } while (TL()) { for (var c = 0; c < cc; c++) TryC(c, random, py, qy); } var (be, bc) = (Mod, -1); for (var i = 0; i < cc; i++) { var e = E(i, py, qy.Slice(l * i, l)); if (e < be) { be = e; bc = i; } } Out(qy.Slice(l * bc + l - n, n).ToArray(), " "); } #region AtCoderIO _io_; var _backend_ = new StandardIOBackend(); _io_ = new(){ Backend = _backend_ }; Run(); _backend_.Flush(); string String() => _io_.Next(); int Int() => int.Parse(String()); void Out(object? x, string? sep = null) => _io_.Out(x, sep); class AtCoderIO { public required StandardIOBackend Backend { get; init; } Memory _input = Array.Empty(); int _iter = 0; public string Next() { while (_iter >= _input.Length) (_input, _iter) = (Backend.ReadLine().Split(' '), 0); return _input.Span[_iter++]; } public void Out(object? x, string? separator = null) { if (x == null) return; separator ??= Environment.NewLine; if (x is System.Collections.IEnumerable a and not string) { var objects = a.Cast(); if (separator == Environment.NewLine && !objects.Any()) return; x = string.Join(separator, objects); } Backend.WriteLine(x); } } class StandardIOBackend { // static readonly StreamReader _sr = new("input.txt"); // static readonly StreamWriter _sw = new("output.txt", false); readonly StreamReader _sr = new(Console.OpenStandardInput()); readonly StreamWriter _sw = new(Console.OpenStandardOutput()) { AutoFlush = false }; public string ReadLine() => _sr.ReadLine()!; public void WriteLine(object? value) => _sw.WriteLine(value); public void Flush() => _sw.Flush(); } #endregion static class Extensions { public static T[] Repeat(this int time, Func F) => Enumerable.Range(0, time).Select(_ => F()).ToArray(); }