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

public class Solver
{
    public const int MaxType = 26;
    public int Days;
    public long[] Downs;
    public long[][] Scores;
    public void Init()
    {
        Days = int.Parse(Console.ReadLine());
        Downs = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        Scores = new long[Days][];
        for (int i = 0; i < Days; i++)
        {
            Scores[i] = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }
    }

    public long CalcScore(int[] plan)
    {
        long score = 0;
        var last = new int[MaxType];
        for (int d = 1; d <= Days; d++)
        {
            var i = d - 1;
            var type = plan[i];
            last[type] = d;
            score += Scores[i][type];
            score -= last.Select((la, index) => Downs[index] * (d - la)).Sum();
        }

        return score;
    }
    public long[] CalcScores(int[] plan)
    {
        var scores = new long[MaxType];
        var last = new int[MaxType];
        for (int d = 1; d <= Days; d++)
        {
            var i = d - 1;
            var type = plan[i];
            last[type] = d;
            scores[type] += Scores[i][type];
            for (int t = 0; t < MaxType; t++)
            {
                if (t != type)
                {
                    scores[t] -= Downs[t] * (d - last[t]);
                }
            }
        }

        return scores;
    }

    public long[] CalcScores(int[] plan, long[] prevScores, int[] changes)
    {
        var scores = prevScores.ToArray();
        var last = new int[MaxType];
        foreach (var t in changes)
        {
            last[t] = 0;
            scores[t] = 0;
            for (int d = 1; d <= Days; d++)
            {
                var i = d - 1;
                var type = plan[i];
                if (type == t)
                {
                    last[t] = d;
                    scores[t] += Scores[i][type];
                }
                else
                {

                    scores[t] -= Downs[t] * (d - last[t]);
                }
            }
        }

        return scores;
    }

    public int[] SolveByGreedy()
    {
        var plan = new int[Days];
        var last = new int[MaxType];
        for (int d = 1; d <= Days; d++)
        {
            var i = d - 1;
            var bestIndex = 0;
            var bestScore = long.MinValue;
            for (int t = 0; t < MaxType; t++)
            {
                var score = Scores[i][t];
                score -= last.Select((la, index) => Downs[index] * (index == t ? 0 : d - la)).Sum();
                if (bestScore < score)
                {
                    bestIndex = t;
                    bestScore = score;
                }
            }
            plan[i] = bestIndex;
            last[bestIndex] = d;
        }

        return plan;
    }
    public int[] SolveByGreedy0()
    {
        var plan = new int[Days];
        var last = new int[MaxType];
        for (int d = 0; d < Days; d++)
        {
            plan[d] = Enumerable.Range(0, MaxType).OrderByDescending(i => Scores[d][i]).First();
        }

        return plan;
    }

    Random random = new Random();

    public int[] SolveBySA(Stopwatch sw, int limit)
    {
        var saTimeCurrent = sw.ElapsedMilliseconds;
        var saTimeStart = saTimeCurrent;
        var saTimeEnd = limit;
        // 許容するスコアの悪化値
        double startTemp = 1000;
        double endTemp = 0.01;
        int count = 0;

        //var plan = Enumerable.Range(0, Days).Select(_ => random.Next(MaxType)).ToArray();
        var plan = SolveByGreedy();
        var scores = CalcScores(plan);
        var currentScore = scores.Sum();
        while (sw.ElapsedMilliseconds < limit)
        {
            saTimeCurrent = sw.ElapsedMilliseconds;
            double temp = startTemp + (endTemp - startTemp) * saTimeCurrent / (saTimeEnd - saTimeStart);

            // 近傍をセット
            var day = random.Next(Days);
            var newType = random.Next(MaxType);
            var prevType = plan[day];
            plan[day] = newType;
            var day2 = -1;
            if (random.Next(2) == 0)
            {
                for (int d = day + 1; d < Days; d++)
                {
                    if (plan[d] == newType)
                    {
                        day2 = d;
                        plan[day2] = prevType;
                        break;
                    }
                }
            }

            var newScores = CalcScores(plan, scores, new int[] { prevType, newType });
            var newScore = newScores.Sum();
            var adopt = newScore > currentScore;
            if (!adopt)
            {
                double probability = Math.Exp((newScore - currentScore) / temp);
                adopt = random.NextDouble() < probability;
            }

            if (adopt)
            {
                currentScore = newScore;
                scores = newScores;
                continue;
            }

            // 近傍への移動をキャンセル
            plan[day] = prevType;
            if (day2 >= 0)
            {
                plan[day2] = newType;
            }
            count++;
        }
        //Console.Error.WriteLine($"count:{count}");
        return plan;
    }

    public int[] Solve()
    {
        var sw = Stopwatch.StartNew();
        //return SolveByGreedy();
        return SolveBySA(sw, 1860);
    }
}

public static class Solution
{
    public static void Main()
    {
        var solver = new Solver();
        solver.Init();
        var answer = solver.Solve();
        Console.WriteLine(string.Join(Environment.NewLine, answer.Select(i => i + 1)));
        //Console.Error.WriteLine($"sat:{solver.CalcScore(answer)}");
    }
}

Measured memory_bytes: 47736