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

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

        // mutableな状態
        public int[] Command;
        public double score;
        public double bestScore;
        public int[] bestCommand;

        // パラメータ
        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 = 0.0;
            double finT = 0.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()
        {
            Command = new int[D];
            for (int d = 0; d < D; d++)
            {
                Command[d] = rnd.Next(K); // d % 26;
            }
            score = CalcScore(Command);

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

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

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

                    double 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 = CalcScoreSwap(Command, p1_r1, p1_r2);
                        // logger.Info($"score: {score} -> {newScore}");
                    }
                    else
                    {
                        // 1点更新
                        flg = 2;
                        p2_d1 = rnd.Next(D);
                        p2_v1 = rnd.Next(K);
                        newScore = CalcScoreChange(Command, p2_d1, p2_v1);
                        // logger.Info($"score: {score} -> {newScore}");
                    }

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

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

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

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

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

        long CalcScore(int[] command)
        {
            long score = 0;
            int[] last = new int[K];
            for (int d = 0; d < D; d++)
            {
                int ks = command[d];
                score += S[d, ks];
                last[ks] = d + 1;
                for (int k = 0; k < K; k++)
                {
                    score -= (d + 1 - last[k]) * C[k];
                }
            }
            return score;
        }

        long CalcScoreSwap(int[] command, int r1, int r2)
        {
            int v1_orig = command[r1];
            int v2_orig = command[r2];
            command[r1] = v2_orig;
            command[r2] = v1_orig;
            long ret =  CalcScore(command);
            command[r1] = v1_orig;
            command[r2] = v2_orig;
            return ret;
        }

        long CalcScoreChange(int[] command, int r1, int v1)
        {
            int v1_orig = command[r1];
            command[r1] = v1;
            long ret = CalcScore(command);
            command[r1] = v1_orig;
            return ret;
        }

        void UpdateSwap(int[] command, int r1, int r2)
        {
            int v1 = command[r1];
            int v2 = command[r2];
            command[r1] = v2;
            command[r2] = v1;
        }

        void UpdateChange(int[] command, int r1, int v1)
        {
            command[r1] = v1;
        }
    }

    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 it = InitialT;
            double ft = FinalT;
            // 線形とした
            // TODO: 指数関数型への変更
            Temperature = it * (1 - t) + ft * 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: 25128