Problem:
Problem Statement

AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to schedule contests for D days so that user satisfaction is as high as possible. For every day, AtCoder will hold exactly one contest, and each contest will end on that day. The satisfaction is calculated as follows.

The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.

Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.

If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).

Please schedule contests on behalf of AtCoder.
If the satisfaction at the end of day D is S, you will get a score of \max(10^6 + S, 0).
There are 50 test cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your submissions will be your score.

Constraints

D = 365

Each c_i is an integer satisfying 0\leq c_i \leq 100.

Each s_{d,i} is an integer satisfying 0\leq s_{d,i} \leq 20000.

Input

Input is given from Standard Input in the following format:

D
c_1 c_2 \cdots c_{26}
s_{1,1} s_{1,2} \cdots s_{1,26}
\vdots
s_{D,1} s_{D,2} \cdots s_{D,26}

Output

Let t_d (1\leq t_d \leq 26) be the type of the contest that will be held at day d.
Print D integers t_d to Standard Output in the following format:

t_1
t_2
\vdots
t_D

Any output that does not follow the above format may result in 0 pointsWA for that test case.

Input Generation

Each integer c_i and s_{d,i} is generated independently and uniformly at random from the integers in the range described in the problem statement.

Sample Input 1

5
86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82
19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570
6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256
8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452
19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192

Sample Output 1

1
17
13
14
13

Note that this example is a small one for checking the problem specification. It does not satisfy the constraint D=365 and is never actually given as a test case. The final satisfaction with this output is 79325, so the score is 1079325.

Input generator, score calculator, and visualizer

Beginner's Guide

If you don't know what to do, proceed to problem B or C.

Solution in C# (Mono-csc 3.5.0) (judge verdict: Accepted)

using System;
using System.Linq;
using System.Collections.Generic;

namespace Contest
{
  class Program
  {
    static void Main(string[] args)
    {
      IntroductionToHeuristics.A();
      //IntroductionToHeuristics.Test();
    }
    class IntroductionToHeuristics
    {
      public static void A()
      {
        bool debug = false;

        var D = Read.Int();
        var C = Read.IntN();
        var S = Read.LongMatrix(D, 26);

        var state = new State(D, C, S);
        //state.OutputState();
        for (int i = 0; i < 10; ++i)
        {
          LocalD(state, debug);
        }
        int thresholdInit = 5000;
        for (int i = 0; i < 50; ++i)
        {
          var threshold = Math.Max(0, thresholdInit * (40 - i) / 50);
          SwapD(state, 1, threshold, debug);
          SwapD(state, 8, threshold, debug);
          SwapD(state, 10, threshold, debug);
          SwapD(state, 5, threshold, debug);
          SwapD(state, 4, threshold, debug);
          SwapD(state, 11, threshold, debug);
          LocalD(state, debug);
          SwapD(state, 7, threshold, debug);
          SwapD(state, 2, threshold, debug);
          SwapD(state, 8, threshold, debug);
          SwapD(state, 12, threshold, debug);
          SwapD(state, 6, threshold, debug);
          SwapD(state, 9, threshold, debug);
          LocalD(state, debug);
        }
        for (int i = 0; i < 10; ++i)
        {
          LocalD(state, debug);
        }
        if (!debug)
        {
          state.OutputAnswer();
        }
      }
      public static void Test()
      {
        long sum = 0;
        for(int i = 0; i < 10; ++i)
        {
          var score = Solve(Generate(i + 1));
          Console.WriteLine("{0} {1}", i, score);
          sum += score;
        }
        Console.WriteLine(sum);
      }
      static long Solve(State state)
      {
        bool debug = false;
        for (int i = 0; i < 10; ++i)
        {
          LocalD(state, debug);
        }
        int thresholdInit = 5000;
        for (int i = 0; i < 50; ++i)
        {
          var threshold = Math.Max(0, thresholdInit * (40 - i) / 50);
          SwapD(state, 1, threshold, debug);
          SwapD(state, 8, threshold, debug);
          SwapD(state, 10, threshold, debug);
          SwapD(state, 5, threshold, debug);
          SwapD(state, 4, threshold, debug);
          SwapD(state, 11, threshold, debug);
          LocalD(state, debug);
          SwapD(state, 7, threshold, debug);
          SwapD(state, 2, threshold, debug);
          SwapD(state, 8, threshold, debug);
          SwapD(state, 12, threshold, debug);
          SwapD(state, 6, threshold, debug);
          SwapD(state, 9, threshold, debug);
          LocalD(state, debug);
        }
        for (int i = 0; i < 10; ++i)
        {
          SwapD(state, 1, 0, debug);
          LocalD(state, debug);
        }
        return state.CalcScore();
      }
      static void LocalD(State state, bool output)
      {
        for (int d = 0; d < state.D; ++d)
        {
          int max = -1;
          long maxScore = Int32.MinValue;
          for (int p = 0; p < 26; ++p)
          {
            var s = state.CalcChange(d, p);
            if (maxScore < s)
            {
              max = p;
              maxScore = s;
            }
          }
          state.ApplyChange(d, max);
        }
        if (output)
        {
          state.OutputState();
        }
      }
      static void SwapD(State state, int interval, int threshold, bool output)
      {
        for (int d = 0; d < state.D - interval; ++d)
        {
          var t0 = state.T[d];
          var t1 = state.T[d + interval];
          var change1 = state.CalcChange(d, t1);
          state.ApplyChange(d, t1);
          var change2 = state.CalcChange(d + interval, t0);
          if (change1 + change2 > -threshold)
          {
            state.ApplyChange(d + interval, t0);
          }
          else
          {
            state.ApplyChange(d, t0);
          }
        }
        if (output)
        {
          state.OutputState();
        }
      }
      static State Generate(int seed)
      {
        var rand = new Random(seed);
        int D = 365;
        var C = Enumerable.Range(0, 26).Select(i => rand.Next() % 101).ToArray();
        var S = new long[365, 26];
        for(int i = 0; i < D; ++i)
        {
          for(int j = 0; j < 26; ++j)
          {
            S[i, j] = rand.Next() % 20001;
          }
        }
        return new State(D, C, S);
      }


      public static void B()
      {
        var D = Read.Int();
        var C = Read.IntN();
        var S = Read.LongMatrix(D, 26);
        var T = Enumerable.Range(0, D).Select(i => Read.Int()).ToArray();
        var last = new int[26];
        long score = 0;
        var ans = new List<long>();
        for(int i = 0; i < D; ++i)
        {
          score += S[i, T[i] - 1];
          last[T[i] - 1] = i + 1;
          for(int j = 0; j < 26; ++j)
          {
            score -= C[j] * (i + 1 - last[j]);
          }
          ans.Add(score);
        }
        Console.WriteLine(String.Join(Environment.NewLine, ans));
      }
      public static void C()
      {
        var D = Read.Int();
        var C = Read.IntN();
        var S = Read.LongMatrix(D, 26);
        var T = Enumerable.Range(0, D).Select(i => Read.Int() - 1).ToArray();
        var M = Read.Int();
        var DQ = Read.TupleInt(M);
        var LastDays = Enumerable.Range(0, 26).Select(i => new Util.Set<int>()).ToArray();
        for(int i = 0; i < 26; ++i)
        {
          LastDays[i].Insert(-1);
          LastDays[i].Insert(D);
        }
        var last = Enumerable.Range(0, 26).Select(i => -1).ToArray();
        long score = 0;
        var ans = new List<long>();
        for (int i = 0; i < D; ++i)
        {
          score += S[i, T[i]];
          last[T[i]] = i;
          for (int j = 0; j < 26; ++j)
          {
            score -= C[j] * (i - last[j]);
          }
          LastDays[T[i]].Insert(i);
        }
        for(int i = 0; i < M; ++i)
        {
          var d = DQ[i].Item1 - 1;
          var q = DQ[i].Item2 - 1;
          var p = T[d];
          if (p == q) { ans.Add(score); continue; }
          T[d] = q;
          score += -S[d, p] + S[d, q];
          var prevQ = LastDays[q].ElementAt(LastDays[q].LowerBound(d) - 1);
          var nextQ = LastDays[q].ElementAt(LastDays[q].LowerBound(d));
          var prevP = LastDays[p].ElementAt(LastDays[p].LowerBound(d) - 1);
          var nextP = LastDays[p].ElementAt(LastDays[p].LowerBound(d + 1));
          score += C[q] * (d - prevQ) * (nextQ - d) - C[p] * (d - prevP) * (nextP - d);
          LastDays[q].Insert(d);
          LastDays[p].Remove(d);
          ans.Add(score);
        }
        Console.WriteLine(String.Join(Environment.NewLine, ans));
      }

      class State
      {
        public int D;
        int[] C;
        long[,] S;
        Util.Set<int>[] LastDays;
        public int[] T;

        public State(int D, int[] C, long[,] S)
        {
          this.D = D;
          this.C = C;
          this.S = S;
          LastDays = Enumerable.Range(0, 26).Select(i => new Util.Set<int>()).ToArray();
          for (int i = 0; i < 26; ++i)
          {
            LastDays[i].Insert(-1);
            LastDays[i].Insert(D);
          }
          this.T = new int[D];
          for(int d = 0; d < D; ++d)
          {
            LastDays[0].Insert(d);
          }
        }

        public long CalcScore()
        {
          long score = 0;
          var Last = Enumerable.Range(0, 26).Select(i => -1).ToArray();
          var ans = new List<long>();
          for (int i = 0; i < D; ++i)
          {
            score += S[i, T[i]];
            Last[T[i]] = i;
            for (int j = 0; j < 26; ++j)
            {
              score -= C[j] * (i - Last[j]);
            }
          }
          return score;
        }
        public long CalcChange(int d, int q)
        {
          var p = T[d];
          if (p == q) { return 0; }
          long change = 0;
          change += -S[d, p] + S[d, q];
          var prevQ = LastDays[q].ElementAt(LastDays[q].LowerBound(d) - 1);
          var nextQ = LastDays[q].ElementAt(LastDays[q].LowerBound(d));
          var prevP = LastDays[p].ElementAt(LastDays[p].LowerBound(d) - 1);
          var nextP = LastDays[p].ElementAt(LastDays[p].LowerBound(d + 1));
          change += C[q] * (d - prevQ) * (nextQ - d) - C[p] * (d - prevP) * (nextP - d);
          return change;
        }
        public void ApplyChange(int d,int q)
        {
          var p = T[d];
          if (p == q) { return; }
          T[d] = q;
          LastDays[q].Insert(d);
          LastDays[p].Remove(d);
        }
        public void OutputState()
        {
          Console.WriteLine("{0} {1}", CalcScore(), String.Join(" ", T));
        }
        public void OutputAnswer()
        {
          Console.WriteLine(String.Join(Environment.NewLine, T.Select(x => x + 1)));
        }
      }
    }

    class Util
    {
      public static T[,] Gen<T>(int r, int c, T v)
      {
        var matrix = new T[r, c];
        for (int i = 0; i < r; ++i)
        {
          for (int j = 0; j < c; ++j)
          {
            matrix[i, j] = v;
          }
        }
        return matrix;
      }
      public static long[] ASum(long[] array)
      {
        var res = new long[array.Length + 1];
        for (int i = 0; i < array.Length; ++i)
        {
          res[i + 1] = res[i] + array[i];
        }
        return res;
      }
      public static long[,] ASum(long[,] matrix)
      {
        var N = matrix.GetLength(0);
        var M = matrix.GetLength(1);
        var res = new long[N + 1, M + 1];
        for(int i = 0; i < N; ++i)
        {
          for(int j = 0; j < M; ++j)
          {
            res[i + 1, j + 1] = res[i, j + 1] + res[i + 1, j] - res[i, j] + matrix[i, j];
          }
        }
        return res;
      }
      public static Dictionary<T, long> Frequency<T>(T[] array)
      {
        var dict = new Dictionary<T, long>();
        foreach (var a in array)
        {
          if (!dict.ContainsKey(a)) { dict.Add(a, 0); }
          dict[a]++;
        }
        return dict;
      }

      public class BST<T> where T : IComparable
      {
        public class Node
        {
          public T V;
          public Node L, R;
          public int Count;
          public Node(T v) { V = v; Count = 1; }
        }
        static Random _rnd = new Random();
        public static int Count(Node t) { return t == null ? 0 : t.Count; }
        static Node Update(Node t) { t.Count = Count(t.L) + Count(t.R) + 1; return t; }
        public static Node Merge(Node l, Node r)
        {
          if (l == null || r == null) return l == null ? r : l;
          if ((double)Count(l) / (double)(Count(l) + Count(r)) > _rnd.NextDouble())
          { l.R = Merge(l.R, r); return Update(l); }
          else { r.L = Merge(l, r.L); return Update(r); }
        }
        public static Tuple<Node, Node> Split(Node t, int k)
        {
          if (t == null) return new Tuple<Node, Node>(null, null);
          if (k <= Count(t.L))
          {
            var s = Split(t.L, k);
            t.L = s.Item2;
            return new Tuple<Node, Node>(s.Item1, Update(t));
          }
          else
          {
            var s = Split(t.R, k - Count(t.L) - 1);
            t.R = s.Item1;
            return new Tuple<Node, Node>(Update(t), s.Item2);
          }
        }
        public static Node Remove(Node t, T v)
        {
          if (Find(t, v) == null) return t;
          return RemoveAt(t, LowerBound(t, v));
        }
        public static Node RemoveAt(Node t, int k)
        {
          var s = Split(t, k);
          var s2 = Split(s.Item2, 1);
          return Merge(s.Item1, s2.Item2);
        }
        public static bool Contains(Node t, T v) { return Find(t, v) != null; }
        public static Node Find(Node t, T v)
        {
          while (t != null)
          {
            var cmp = t.V.CompareTo(v);
            if (cmp > 0) t = t.L;
            else if (cmp < 0) t = t.R;
            else break;
          }
          return t;
        }

        public static Node FindByIndex(Node t, int idx)
        {
          if (t == null) return null;
          var currentIdx = Count(t) - Count(t.R) - 1;
          while (t != null)
          {
            if (currentIdx == idx) return t;
            if (currentIdx > idx)
            { t = t.L; currentIdx -= (Count(t == null ? null : t.R) + 1); }
            else { t = t.R; currentIdx += (Count(t == null ? null : t.L) + 1); }
          }
          return null;
        }
        public static int UpperBound(Node t, T v)
        {
          var torg = t;
          if (t == null) return -1;

          var ret = Int32.MaxValue;
          var idx = Count(t) - Count(t.R) - 1;
          while (t != null)
          {
            var cmp = t.V.CompareTo(v);

            if (cmp > 0)
            {
              ret = Math.Min(ret, idx);
              t = t.L;
              idx -= (Count(t == null ? null : t.R) + 1);
            }
            else if (cmp <= 0)
            {
              t = t.R;
              idx += (Count(t == null ? null : t.L) + 1);
            }
          }
          return ret == Int32.MaxValue ? Count(torg) : ret;
        }
        public static int LowerBound(Node t, T v)
        {
          var torg = t;
          if (t == null) return -1;

          var idx = Count(t) - Count(t.R) - 1;
          var ret = Int32.MaxValue;
          while (t != null)
          {
            var cmp = t.V.CompareTo(v);
            if (cmp >= 0)
            {
              if (cmp == 0) ret = Math.Min(ret, idx);
              t = t.L;
              if (t == null) ret = Math.Min(ret, idx);
              idx -= t == null ? 0 : (Count(t.R) + 1);
            }
            else if (cmp < 0)
            {
              t = t.R;
              idx += (Count(t == null ? null : t.L) + 1);
              if (t == null) return idx;
            }
          }
          return ret == Int32.MaxValue ? Count(torg) : ret;
        }
        public static Node Insert(Node t, T v)
        {
          var ub = LowerBound(t, v);
          return InsertByIdx(t, ub, v);
        }
        static Node InsertByIdx(Node t, int k, T v)
        {
          var s = Split(t, k);
          return Merge(Merge(s.Item1, new Node(v)), s.Item2);
        }
        public static IEnumerable<T> Enumerate(Node t)
        {
          var ret = new List<T>();
          Enumerate(t, ret);
          return ret;
        }
        static void Enumerate(Node t, List<T> ret)
        {
          if (t == null) return;
          Enumerate(t.L, ret);
          ret.Add(t.V);
          Enumerate(t.R, ret);
        }
      }
      public class Set<T> where T : IComparable
      {
        protected BST<T>.Node _root;
        public T this[int idx] { get { return ElementAt(idx); } }
        public int Count() { return BST<T>.Count(_root); }
        public virtual void Insert(T v)
        {
          if (_root == null) _root = new BST<T>.Node(v);
          else
          {
            if (BST<T>.Find(_root, v) != null) return;
            _root = BST<T>.Insert(_root, v);
          }
        }
        public void Clear() { _root = null; }
        public void Remove(T v) { _root = BST<T>.Remove(_root, v); }
        public bool Contains(T v) { return BST<T>.Contains(_root, v); }
        public T ElementAt(int k)
        {
          var node = BST<T>.FindByIndex(_root, k);
          if (node == null) throw new IndexOutOfRangeException();
          return node.V;
        }
        public int Count(T v) { return BST<T>.UpperBound(_root, v) - BST<T>.LowerBound(_root, v); }
        public int LowerBound(T v) { return BST<T>.LowerBound(_root, v); }
        public int UpperBound(T v) { return BST<T>.UpperBound(_root, v); }
        public Tuple<int, int> EqualRange(T v)
        {
          if (!Contains(v)) return new Tuple<int, int>(-1, -1);
          return new Tuple<int, int>(BST<T>.LowerBound(_root, v), BST<T>.UpperBound(_root, v) - 1);
        }
        public List<T> ToList() { return new List<T>(BST<T>.Enumerate(_root)); }
      }
    }

    static class Read
{
static Queue<string> queue = new Queue<string>();
static void Enqueue() { var ss = Console.ReadLine().Split(' '); foreach (var s in ss) { queue.Enqueue(s); } }
public static int Int() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt32(queue.Dequeue()); }
public static long Long() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt64(queue.Dequeue()); }
public static string Str() { if (queue.Count == 0) { Enqueue(); } return queue.Dequeue(); }
public static int[] IntN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray(); }
public static long[] LongN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt64(s)).ToArray(); }
public static ulong[] ULongN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToUInt64(s)).ToArray(); }
public static string[] StrN() { return Console.ReadLine().Split(' '); }
public static Tuple<int, int>[] TupleInt(int n) { List<Tuple<int, int>> list = new List<Tuple<int, int>>(); for (int i = 0; i < n; ++i) { var ab = Read.IntN(); list.Add(new Tuple<int, int>(ab[0], ab[1])); } return list.ToArray(); }
public static Tuple<long, long>[] TupleLong(int n) { List<Tuple<long, long>> list = new List<Tuple<long, long>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<long, long>(ab[0], ab[1])); } return list.ToArray(); }
public static Tuple<string, string>[] TupleStr(int n) { List<Tuple<string, string>> list = new List<Tuple<string, string>>(); for (int i = 0; i < n; ++i) { var ab = Read.StrN(); list.Add(new Tuple<string, string>(ab[0], ab[1])); } return list.ToArray(); }
public static Tuple<double, double>[] TupleDouble(int n) { List<Tuple<double, double>> list = new List<Tuple<double, double>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<double, double>(ab[0], ab[1])); } return list.ToArray(); }
public static long[,] LongMatrix(int r, int c) { var mat = new long[r, c]; for (int i = 0; i < r; ++i) { var x = Read.LongN(); for (int j = 0; j < c; ++j) { mat[i, j] = x[j]; } } return mat; }
public static Dictionary<int, HashSet<int>> AdjacencyList(int N, int M, bool isDirectional = false)
{
Dictionary<int, HashSet<int>> dict = new Dictionary<int, HashSet<int>>();
for (int i = 0; i <= N; ++i) { dict.Add(i, new HashSet<int>()); }
        for (int i = 0; i < M; ++i) { var ab = Read.IntN(); if (!dict[ab[0]].Contains(ab[1])) { dict[ab[0]].Add(ab[1]); } if (!isDirectional && !dict[ab[1]].Contains(ab[0])) { dict[ab[1]].Add(ab[0]); } }
        return dict;
}
public static Dictionary<int, Dictionary<int, long>> AdjacencyListWithWeight(int N, int M)
{
Dictionary<int, Dictionary<int, long>> dict = new Dictionary<int, Dictionary<int, long>>(); for (int i = 0; i <= N; ++i) { dict.Add(i, new Dictionary<int, long>()); }
for (int i = 0; i < M; ++i) { var ab = Read.IntN(); dict[ab[0]].Add(ab[1], ab[2]); dict[ab[1]].Add(ab[0], ab[2]); }
return dict;
}
}
    }
}