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

namespace AtCoder2.Heuristic
{
    class Node
    {
        public Node[] NodeStack;
        /// <summary>積み終わったコンテストの数</summary>
        public int Day;
        public int[] Contests;
        public int[] ContestPenalties = new int[26];
        public long Score;
        public int NextPenalty;                         // 総和は最大で3650
        public Node AddContest(int contestNo)
        {
            var node = new Node()
            {
                Day = Day + 1,
                Contests = new int[Day+1],
                NodeStack = new Node[Day+1],
            };
            Array.Copy(Contests, node.Contests, Day);
            Array.Copy(NodeStack, node.NodeStack, Day);
            node.Score = Score - NextPenalty + ContestPenalties[contestNo] + Introduction.ContestScore[Day][contestNo];
            node.NodeStack[Day] = this;
            node.Contests[Day] = contestNo;

            node.ContestPenalties[contestNo] = 0;
            node.NextPenalty = 0;
            for (var i = 0; i < 26; i++)
            {
                node.ContestPenalties[i] = (i == contestNo ? 0 : ContestPenalties[i]) + Introduction.ScoreMinus[i];
                node.NextPenalty += node.ContestPenalties[i];
            }

            return node;
        }
    }

    class Introduction
    {
        public static List<int> ScoreMinus = new List<int>();
        public static List<List<int>> ContestScore = new List<List<int>>();
        static System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();


        static Random Random = new Random(42);


        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());  // 365

            ScoreMinus = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            for (int i = 0; i < N; i++)
            {
                ContestScore.Add(Console.ReadLine().Split(' ').Select(int.Parse).ToList());
            }

            sw.Start();

            var startNode = new Node();
            for (int i = 0; i < 26; i++)
            {
                startNode.ContestPenalties[i] += ScoreMinus[i];
                startNode.NextPenalty += ScoreMinus[i];
            }
            /*
                        // B問題シミュレーション
                        var bNode = new Node() { NextPenalty = startNode.NextPenalty, Contests = new List<int>(), ContestPenalties = startNode.ContestPenalties.ToArray(), NodeStack = new List<Node>() };

                        for (int i = 0; i < N; i++)
                        {
                            int v = int.Parse(Console.ReadLine()) - 1;
                            bNode = bNode.AddContest(v);
                            Console.WriteLine(bNode.Score);
                        }
                        return;
            */

            Stack<Node> nodes = new Stack<Node>();

            var bestNode = new Node() { NextPenalty = startNode.NextPenalty, Contests = new int[1], ContestPenalties = startNode.ContestPenalties.ToArray(), NodeStack = new Node[1] };
            while (bestNode.Day < N)
            {
                var bestContestNo = -1;
                var bestScore = int.MinValue;
                for (int i = 0; i<26;i++)
                {
                    var score = ContestScore[bestNode.Day][i] + bestNode.ContestPenalties[i];
                    if (score > bestScore)
                    {
                        bestScore = score;
                        bestContestNo = i;
                    }
                }
                bestNode = bestNode.AddContest(bestContestNo);
                nodes.Push(bestNode);
            }

            // game loop
            while (sw.ElapsedMilliseconds <= -1900)
            {
                int startDay = (int)(N * (sw.ElapsedMilliseconds / 2000.0));
                var node = bestNode.NodeStack[startDay];

                while (node.Day < N)
                {
                    node = node.AddContest(Random.Next(26));
                }

                if (node.Score > bestNode.Score)
                {
                    bestNode = node;
                    Console.Error.WriteLine($"@ score:{node.Score}");
                }
            }


            for (int i = 0; i < N; i++)
            {
                Console.WriteLine(bestNode.Contests[i] + 1);
            }


        }
    }

}


Measured memory_bytes: 29800