// 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 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 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 TL0 = 900;
        public long TL = 1900;

        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 int D;
        public int K = 26;
        public int[] C;
        public int[,] S;

        // immutableな状態        
        public char[,] MAP;
        
        // mutableな状態
        public State bestState;
        public List<int> answer;

        // パラメータ
        public int Seed;

        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);
            TL0 = 1200;
            TL = 1900;
            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);

            // 計算の実行
            logger = new Logger(DEBUG);
            Solve();
          
            // 出力
            WriteAnswer();
            // logger.Info($"score: {calcScore(Order)}");
            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()
        {
            bestState = new State();
            bestState.score = 0;
            bestState.commands = new List<int>();
            for (int d = 0; d < D; d++)
            {
                bestState.commands.Add(d % 26);
            }
            
            // 探索 - chokudai search
            int beamDepth = D;
            int beamWidth = 20;
            var beams = new PriorityQueue<State>[beamDepth + 1];
            Comparison<State> comparison = State.Comparison;
            for (int b = 0; b < beamDepth + 1; b++)
            {
                beams[b] = new PriorityQueue<State>(comparison);
            }
            
            var initState = State.InitialState();
            beams[0].Push(initState);
            
            int chokudaiSearchIter = 0;

            while (!(timer.Elapsed > TL0))
            {
                logger.Debug($"ci:{chokudaiSearchIter}");                
                chokudaiSearchIter++;
                for (int t = 0; t < D; t++)
                {
                    int currDepth = t;
                    int nextDepth = (t + 1);

                    // 時間計測
                    if (t % 8 == 0 && timer.Elapsed > TL0)
                    {
                        break;
                    }

                    // ビーム幅分の状態から次の時間の状態を作成する
                    for (int iter = 0; iter < beamWidth; iter++)
                    {
                        if (beams[currDepth].Count() == 0) break;
                        State currSearchState = beams[currDepth].Pop();
                        Simulate(currSearchState, beams[nextDepth], t);
                    }

                    // ビーム幅の上限を超えるcurrentDepthのビームを削除する
                    // TODO: メモリの要請がない限り必ずしも消す必要はない
                    if (beams[t].Count() > beamWidth)
                    {
                        var remainBeam = new PriorityQueue<State>(comparison);
                        for (int iter = 0; iter < beamWidth; iter++)
                        {
                            remainBeam.Push(beams[currDepth].Pop());
                        }

                        beams[currDepth] = remainBeam;
                    }
                }
            }

            Random random = new Random(71);
            double bestScore = bestState.score;
            List<int> bestCommand = bestState.commands;
            int trial = 0;
            while (true)
            {
                trial++;
                if (trial % 20 == 0 && timer.Elapsed > TL)
                    break;
                
                int i1 = random.Next(D);
                int i2 = i1 + random.Next(4);
                if (i2 >= D) continue;
                var newCommand = bestCommand.ToList();
                int tmp = bestCommand[i1];
                newCommand[i1] = bestCommand[i2];
                newCommand[i2] = tmp;
                double newScore = CalcScore(newCommand);
                if (newScore > bestScore)
                {
                    bestCommand = newCommand;
                    bestScore = newScore;
                    // logger.Info($"climb score: {bestScore}");
                }
            }

            answer = bestCommand;
            // logger.Info($"final satisfaction: {bestScore}");

        }

        void Simulate(State state, PriorityQueue<State> beam, int t)
        {
            // TODO: 枝刈り
            // TODO: 重複処理
            for (int k = 0; k < K; k++)
            {
                var nextState = state.Copy();

                // command
                nextState.commands.Add(k);
                nextState.score = CalcScore(nextState, t);
                nextState.evalScore = Evaluate(nextState, t);
                
                if (t + 1 < D)
                {
                    beam.Push(nextState);
                }
                else
                {
                    if (nextState.score > bestState.score)
                    {
                        bestState = nextState;
                        // logger.Debug($"satisfaction: {bestState.score}");
                    }
                }
            }
        }
        
        void WriteAnswer()
        {
            for (int i = 0; i < answer.Count; i++)
            {
                // 1-indexedに直す
                writer.WriteLine(answer[i] + 1);
            }
        }

        double CalcScore(State state, int t)
        {
            double score = state.score;
            int ks = state.commands.Last();
            score += S[t, ks];
            state.last[ks] = t + 1;
            for (int k = 0; k < K; k++)
            {
                score -= (t + 1 - state.last[k]) * C[k];
            }
            return score;
        }
        
        double CalcScore(List<int> command)
        {
            double score = 0.0;
            int[] last = new int[K];
            for (int t = 0; t < D; t++)
            {
                int ks = command[t];
                score += S[t, ks];
                last[ks] = t + 1;
                for (int k = 0; k < K; k++)
                {
                    score -= (t + 1 - last[k]) * C[k];
                }
            }
            return score;
        }
        
        double Evaluate(State state, int t)
        {
            // 少しだけ先を反映
            double factor = 5;
            double penalty = 0;
            for (int k = 0; k < K; k++)
            {
                int elapsed = t + 1 - state.last[k];
                penalty += elapsed * C[k] * factor;
            }
            return state.score - penalty;
        }

    }

    public struct State
    {
        public int[] last;
        public List<int> commands;
        public double score;
        public double evalScore;

        public static State InitialState()
        {
            int K = 26;
            var ret = new State();
            ret.last = new int[K];
            ret.score = 0;
            ret.evalScore = 0;
            ret.commands = new List<int>();
            return ret;
        }

        public State Copy()
        {
            var ret = new State();
            ret.last = last.ToArray();
            ret.score = score;
            ret.evalScore = evalScore;
            ret.commands = commands.ToList();
            return ret;
        }
        
        // スコアが高い方が比較上小さくなる
        public static Comparison<State> Comparison
            = (State s1, State s2) => s1.evalScore.CompareTo(s2.evalScore) * (-1);
    }

    public class Data
    {
        public int x;
        public int y;
        public int d;
        public int dist;

        public Data(int y, int x, int d, int dist)
        {
            this.x = x;
            this.y = y;
            this.d = d;
            this.dist = dist;
        }
        
        public static Comparison<Data> Comparison
            = (Data s1, Data s2) => s1.dist.CompareTo(s2.dist);
    }
    
}

// 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: 74488