// USING ON -----

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

// USING OFF -----
// USING ON -----

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Marathon;

// USING OFF -----
// USING ON -----

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml.Xsl.Runtime;

// USING OFF -----
// USING ON -----

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

// USING OFF -----
// CONTENT ON -----

// CONTENT OFF -----
// CONTENT ON -----

#region Utility

namespace Marathon.Problem
{
    /// <summary>
    /// ロギング
    /// </summary>
    public class Logger
    {
        public bool Verbose;
        private StreamWriter streamWriter;

        public Logger(bool verbose, string path = @"result/log.log")
        {
            Verbose = verbose;
            if (Verbose)
            {
                System.IO.Directory.CreateDirectory(Path.GetDirectoryName(path));
                streamWriter = new StreamWriter(path);
            }
        }

        public void Fatal(string message)
        {
            Console.Error.WriteLine(message);
            if(streamWriter != null)
                streamWriter.WriteLine(message);
        }

        public void Info(string message)
        {
            if (Verbose)
            {
                Console.Error.WriteLine(message);
                streamWriter.WriteLine(message);
            }
        }

        public void Debug(string message)
        {
            if (Verbose)
            {
                streamWriter.WriteLine(message);
            }
        }

        public void Close()
        {
            if (Verbose)
            {
                if (streamWriter != null)
                    streamWriter.Close();
            }
        }
    }

    
    /// <summary>
    /// 時間計測 
    /// </summary>
    public class Timer
    {
        private long StartTime;

        public static long NowUnixTime()
        {
            return new DateTimeOffset(DateTime.Now).ToUnixTimeMilliseconds();
        }

        public void Start()
        {
            StartTime = NowUnixTime();
        }

        public long Elapsed
        {
            get { return NowUnixTime() - StartTime; }
        }
    }

    /// <summary>
    /// プロファイリング目的の時間計測 
    /// </summary>

    public class TimerStat
    {
        
        List<long> sum = new List<long>();
        List<long> start = new List<long>();

        public void Start(int i)
        {
            if (Runner.MEASURE_TIME)
            {
                while (sum.Count() <= i)
                {
                    sum.Add(0L);
                    start.Add(0L);
                }

                start[i] = Timer.NowUnixTime();
            }
        }

        public void Stop(int i)
        {
            if (Runner.MEASURE_TIME)
            {
                sum[i] += Timer.NowUnixTime() - start[i];
            }
        }

        public void Print()
        {
            if (Runner.MEASURE_TIME && sum.Count > 0)
            {
                var sb = new StringBuilder();
                sb.Append("[");
                for (int i = 0; i < sum.Count; i++)
                {
                    sb.Append(sum[i]);
                    sb.Append(", ");
                }

                sb.Append("]");
                Console.Error.WriteLine(sb.ToString());
            }
        }
    }

    /// <summary>
    /// ユーティリティ（拡張メソッド）
    /// </summary>
    static class UtilExtension
    {
        public static string Show<T>(this T[,] ary)
        {
            var sb = new StringBuilder();
            sb.AppendLine("---------------------");
            int h = ary.GetLength(0);
            int w = ary.GetLength(1);
            for (int y = 0; y < h; y++)
            {
                for (int x = 0; x < w; x++)
                {
                    sb.Append(ary[y, x]);
                    if (x < w)
                        sb.Append(',');
                }

                if (y < h)
                    sb.Append('\n');
            }

            sb.AppendLine("---------------------");

            return sb.ToString();
        }
        
        public static string Show(this int[,,] ary, int INF)
        {
            var sb = new StringBuilder();
            sb.AppendLine("====================");
            for (int d = 0; d < ary.GetLength(2); d++)
            {
                int h = ary.GetLength(0);
                int w = ary.GetLength(1);
                for (int y = 0; y < h; y++)
                {
                    for (int x = 0; x < w; x++)
                    {
                        int value = ary[y, x, d];
                        if (value == INF)
                        {
                            sb.Append('.');
                        }
                        else
                        {
                            sb.Append(ary[y, x, d]);
                        }
                        if (x < w)
                            sb.Append(',');
                    }

                    if (y < h)
                        sb.Append('\n');
                }
                sb.AppendLine("---------------------");
            }

            sb.AppendLine("====================");

            return sb.ToString();
        }
    }

    #endregion
}

// CONTENT OFF -----
// CONTENT ON -----
namespace Marathon.Problem
{
    // ReSharper disable once ClassNeverInstantiated.Global
    public class Program
    {
        public static void Main(string[] args)
        {
            var runner = new Runner();
            runner.Run(args);
        }
    }

    public class Runner
    {
        public static string Name = "Initial";
        public static bool DEBUG = false;
        public static bool MEASURE_TIME = false;

        public Timer timer = new Timer();
        public TimerStat timerStat = new TimerStat();
        public long TL = 1800;

        public Random rnd;
        private TextReader reader;
        private TextWriter writer;
        public Logger logger;

        // ユーティリティ
        public char[] DChars = new char[] {'D', 'R', 'U', 'L'};
        public int[] DX = new int[] {0, 1, 0, -1};
        public int[] DY = new int[] {1, 0, -1, 0};

        // 入力パラメータ
        public static int D;
        public static int K = 26;
        public static int[] C;
        public static int[,] S;

        // immutableな状態        
        public char[,] MAP;

        // mutableな状態
        public long bestScore;
        public int[] bestCommand;
        int counter;
        
        // パラメータ
        public int Seed;
        public Annealer annealer;

        public void Run(string[] args)
        {
            timer.Start();
#if LOCAL
            Directory.SetCurrentDirectory(
                Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));
            Directory.CreateDirectory("result");
            string inFileDir = "input";
            string outFileDir = "result";
            string inFileName = "example_02_in.txt";
            string outFileName = "example_02_out_my.txt";
            string inFilePath = Path.Combine(inFileDir, inFileName);
            string outFilePath = Path.Combine(outFileDir, outFileName);
            string inFileCopyPath = Path.Combine(outFileDir, inFileName);
            reader = new StreamReader(inFilePath);
            writer = new StreamWriter(outFilePath);
            File.Copy(inFilePath, inFileCopyPath, overwrite: true);
            TL = 1800;
            DEBUG = true;
#else
            reader = Console.In;
            writer = Console.Out;
#endif
            // 入力データの処理
            {
                {
                    D = int.Parse(reader.ReadLine());
                }
                {
                    C = reader.ReadLine().Split(' ').Select(int.Parse).ToArray();
                }
                {
                    S = new int[D, K];
                    for (int i = 0; i < D; i++)
                    {
                        var values = reader.ReadLine().Split(' ').Select(int.Parse).ToArray();
                        for (int k = 0; k < K; k++)
                        {
                            S[i, k] = values[k];
                        }
                    }
                }
            }

            // 初期化
            int seed = 71;
            rnd = new Random(seed);

            double initT = 2000.0;
            double finT = 600.0;
            annealer = new Annealer(initT, finT);

            // 計算の実行
            logger = new Logger(DEBUG);
            Solve();
            // logger.Info($"score: {calcScore(Order)}");

            // 出力
            WriteAnswer();

            logger.Close();
            writer.Close();

            timerStat.Print();
        }

        int ArgMax(int d)
        {
            int max = -1;
            int index = -1;
            for (int k = 0; k < K; k++)
            {
                int v = S[d, k];
                if (v > max)
                {
                    max = v;
                    index = k;
                }
            }

            return index;
        }

        void Solve()
        {
            var command = new int[D];
            for (int d = 0; d < D; d++)
            {
                command[d] = rnd.Next(K); // d % 26;
            }

            State state = new State(command);

            // 探索
            while (!(timer.Elapsed > TL))
            {
                // 焼きなまし
                long initialTime = timer.Elapsed;
                counter = 0;
                
                for (;;)
                {
                    counter++;

                    // 256ターンごとに処理
                    if ((counter & 0xFF) == 0)
                    {
                        long elapsed = timer.Elapsed;
                        if (elapsed > TL)
                        {
                            logger.Info("turn:" + counter + " bestScore:" + bestScore);
                            break;
                        }

                        if ((counter & 0xFF) == 0)
                        {
                            double anneal_t = 1.0 * (elapsed - initialTime) / (TL - initialTime);
                            annealer.SetTemperature(anneal_t);
                            logger.Info("Cooler:" + annealer.Temperature);
                        }
                    }

                    long newScore;
                    double prob = 0.5;
                    int flg = 0, p1_r1 = 0, p1_r2 = 0, p2_d1 = 0, p2_v1 = 0;
                    if (rnd.NextDouble() < prob)
                    {
                        flg = 1;
                        // 2点swap
                        while (true)
                        {
                            p1_r1 = rnd.Next(D);
                            p1_r2 = p1_r1 + 1 + rnd.Next(16);
                            if (p1_r2 < D)
                                break;
                        }

                        newScore = state.CalcScoreSwap(p1_r1, p1_r2);
                        // logger.Info($"score: {score} -> {newScore}");
                    }
                    else
                    {
                        // 1点更新
                        flg = 2;
                        p2_d1 = rnd.Next(D);
                        p2_v1 = rnd.Next(K);
                        newScore = state.CalcScoreChange(p2_d1, p2_v1);
                        // logger.Info($"score: {score} -> {newScore}");
                    }

                    // Timer1
                    if (annealer.Accept(state.Score, newScore))
                    {
                        // 変更が受理された場合
                        if (flg == 1)
                        {
                            state.UpdateSwap(p1_r1, p1_r2);
                        }

                        if (flg == 2)
                        {
                            state.UpdateChange(p2_d1, p2_v1);
                        }

                        // logger.Debug($"accepted score: {score} turn:{turn} flg:{flg} time:{timer.Elapsed}");

                        // ベスト点数を超えている場合はその状態を保存
                        // TODO: 序盤の更新が多い場合は後半のみにするなど
                        if (bestCommand == null || (state.Score > bestScore))
                        {
                            bestScore = state.Score;
                            bestCommand = state.Command.ToArray();
                            logger.Info("score:" + bestScore + " at turn:" + counter);
                        }
                    }
                }
            }
        }

        void WriteAnswer()
        {
            logger.Fatal($"final score: {bestScore}[{bestScore + 1000000}] time:{timer.Elapsed} counter:{counter}");
            var answer = bestCommand;
            for (int i = 0; i < answer.Length; i++)
            {
                // 1-indexedに直す
                writer.WriteLine(answer[i] + 1);
            }
        }
    }

    public class State
    {
        // 計算の高速化処理を含む
        public int[] Command;
        public long Score;
        public int D = Runner.D;
        public int K = Runner.K;
        public int[] C = Runner.C;
        public int[,] S = Runner.S;

        public List<int[]> Days;
        public long[] ScoresContests;

        public State(int[] command)
        {
            this.Command = command;
            InitialCalc();
        }

        public void InitialCalc()
        {
            ScoresContests = new long[K];
            for (int k = 0; k < K; k++)
            {
                long scoreK = 0;
                int last = 0;
                for (int d = 0; d < D; d++)
                {
                    if (k == Command[d])
                    {
                        scoreK += S[d, k];
                        last = d + 1;
                    }

                    scoreK -= (d + 1 - last) * C[k];
                }

                ScoresContests[k] = scoreK;
            }

            Score = ScoresContests.Sum();
        }

        public long ScoreCalcRaw()
        {
            long[] scoreContests = new long[K];
            for (int k = 0; k < K; k++)
            {
                long scoreK = 0;
                int last = 0;
                for (int d = 0; d < D; d++)
                {
                    if (k == Command[d])
                    {
                        scoreK += S[d, k];
                        last = d + 1;
                    }

                    scoreK -= (d + 1 - last) * C[k];
                }

                scoreContests[k] = scoreK;
            }

            return scoreContests.Sum();
        }

        private void UpdateContest(int k)
        {
            long scoreK = 0;
            int last = 0;
            for (int d = 0; d < D; d++)
            {
                if (k == Command[d])
                {
                    scoreK += S[d, k];
                    last = d + 1;
                }

                scoreK -= (d + 1 - last) * C[k];
            }

            ScoresContests[k] = scoreK;
        }

        private void UpdateScore()
        {
            Score = ScoresContests.Sum();
        }

        private long Diff(int k)
        {
            long scoreK = 0;
            int last = 0;
            for (int d = 0; d < D; d++)
            {
                if (k == Command[d])
                {
                    scoreK += S[d, k];
                    last = d + 1;
                }

                scoreK -= (d + 1 - last) * C[k];
            }

            return scoreK - ScoresContests[k];
        }

        public long CalcScoreChange(int d1, int k1)
        {
            int k1Orig = Command[d1];
            if (k1Orig == k1)
                return Score;

            // 差分計算
            Command[d1] = k1;
            long diff = Diff(k1) + Diff(k1Orig);
            Command[d1] = k1Orig;
            return Score + diff;
        }

        public void UpdateChange(int d1, int k1)
        {
            int k1Orig = Command[d1];
            Command[d1] = k1;
            UpdateContest(k1);
            UpdateContest(k1Orig);
            UpdateScore();
            // if(ScoreCalcRaw() != Score)
            //     throw new Exception();
        }

        public long CalcScoreSwap(int d1, int d2)
        {
            // k1 == k2であればそのまま
            int k1 = Command[d1];
            int k2 = Command[d2];
            if (k1 == k2)
                return Score;

            // 差分計算
            Command[d1] = k2;
            Command[d2] = k1;
            long diff = Diff(k1) + Diff(k2);
            Command[d1] = k1;
            Command[d2] = k2;
            return Score + diff;
        }

        public void UpdateSwap(int d1, int d2)
        {
            int k1 = Command[d1];
            int k2 = Command[d2];
            Command[d1] = k2;
            Command[d2] = k1;
            UpdateContest(k1);
            UpdateContest(k2);
            UpdateScore();
            // if(ScoreCalcRaw() != Score)
            //     throw new Exception();
        }
    }

    public class Annealer
    {
              public double InitialT;
        public double FinalT;
        public double Temperature;
        private Random rand = new Random(71);

        public Annealer(double initialT, double finalT)
        {
            InitialT = initialT;
            FinalT = finalT;
        }

        public void SetTemperature(double t)
        {
            double tp0 = InitialT;
            double tp1 = FinalT;
            // 線形とした
            // TODO: 指数関数型への変更
            // Temperature = it * (1 - t) + ft * t;
            
             Temperature = Math.Pow(tp0, 1.0 - t) * Math.Pow(tp1, t);
        }

        public bool Accept(double prev, double cur)
        {
            if (cur >= prev) return true;
            double loss = cur - prev;
            double prob = Math.Exp(loss / Temperature);
            return rand.NextDouble() < prob;
        }
    }
}


// CONTENT OFF -----
// CONTENT ON -----

namespace Marathon.Problem
{
    #region Structure

    public struct Pos
    {
        public int y;
        public int x;

        public Pos(int y, int x)
        {
            this.y = y;
            this.x = x;
        }
    }

    public class PriorityQueue<T>
    {
        private Comparison<T> _comparison;
        private int _type = 0;

        private T[] _heap;
        private int _sz = 0;

        private int _count = 0;

        /// <summary>
        /// Priority Queue with custom comparer
        /// </summary>
        public PriorityQueue(Comparison<T> comparison)
        {
            _heap = new T[128];
            _comparison = comparison;
        }

        private int Compare(T x, T y)
        {
            return _comparison(x, y);
        }

        public void Push(T x)
        {
            _count++;
            if (_count > _heap.Length)
            {
                var newheap = new T[_heap.Length * 2];
                for (int n = 0; n < _heap.Length; n++) newheap[n] = _heap[n];
                _heap = newheap;
            }

            //node number
            var i = _sz++;

            while (i > 0)
            {
                //parent node number
                var p = (i - 1) / 2;

                if (Compare(_heap[p], x) <= 0) break;

                _heap[i] = _heap[p];
                i = p;
            }

            _heap[i] = x;
        }

        public T Pop()
        {
            _count--;

            T ret = _heap[0];
            T x = _heap[--_sz];

            int i = 0;
            while (i * 2 + 1 < _sz)
            {
                //children
                int a = i * 2 + 1;
                int b = i * 2 + 2;

                if (b < _sz && Compare(_heap[b], _heap[a]) < 0) a = b;

                if (Compare(_heap[a], x) >= 0) break;

                _heap[i] = _heap[a];
                i = a;
            }

            _heap[i] = x;

            return ret;
        }

        public int Count()
        {
            return _count;
        }

        public T Peek()
        {
            return _heap[0];
        }

        public bool Contains(T x)
        {
            for (int i = 0; i < _sz; i++)
                if (x.Equals(_heap[i]))
                    return true;
            return false;
        }

        public void Clear()
        {
            while (this.Count() > 0) this.Pop();
        }

        public IEnumerator<T> GetEnumerator()
        {
            var ret = new List<T>();

            while (this.Count() > 0)
            {
                ret.Add(this.Pop());
            }

            foreach (var r in ret)
            {
                this.Push(r);
                yield return r;
            }
        }

        public T[] ToArray()
        {
            T[] array = new T[_sz];
            int i = 0;

            foreach (var r in this)
            {
                array[i++] = r;
            }

            return array;
        }
    }

    #endregion
}

// CONTENT OFF -----


Measured memory_bytes: 25528