#include <iostream>
#include <vector>
#include <algorithm>
#include <chrono>
#include <cassert>
#include <cmath>

using namespace std;
using namespace chrono;

uint32_t xor128() 
{
    static uint32_t x = 123456789;
    static uint32_t y = 362436069;
    static uint32_t z = 521288629;
    static uint32_t w = 88675123;
    uint32_t t;

    t = x ^ (x << 11);
    x = y; y = z; z = w;
    return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
}

double nextDouble()
{
    return (xor128() + 0.5) * (1.0 / 4294967296.0);
}

const static int NUM_TYPE = 26;

int getFullScore(int D, const vector <int>& C, const vector <int>& T, const vector<vector<int>>& S)
{
    int sat = 0;

    vector <int> last(NUM_TYPE, 0);

    for (int d = 0; d < D; d++)
    {
        const int j = T[d];
        last[j] = d + 1;
        for (int i = 0; i < NUM_TYPE; i++)
        {
            sat -= (d + 1 - last[i]) * C[i];
        }
        sat += S[d][j];
    }

    return sat;
}

int getDeltaScore(int day, int D, const vector <int>& C, const vector <int>& T, const vector<vector<int>>& S)
{
    int t = T[day];
    int ret = S[day][t];

    int prev = day - 1;
    while (prev >= 0 && T[prev] != t)
    {
        prev--;
    }

    int next = day + 1;
    while (next < D && T[next] != t)
    {
        next++;
    }

    ret += (next - day) * (day - prev) *C[t];

    //	ret -= sum(prev, day) * C[T[day]];
    //	ret -= sum(day, next) * C[T[day]];
    //	ret += sum(prev, next) * C[T[day]];

    return ret;
}

int main()
{
    //  入力
    int D;
    cin >> D;
    vector<int> C(NUM_TYPE);
    for (int &c : C)
        cin >> c;
    vector<vector<int>> S(D, vector<int>(NUM_TYPE));
    for (auto &s : S)
        for (auto &x : s)
            cin >> x;

    const int NG = -1;

    auto start = system_clock::now();

    // T[d] d日目に開くコンテスト。T[d]=-1
    vector<int> T(D, -1);

    int score = 0;

    for (int t = 0; t < NUM_TYPE; t++)
    {
        score -= C[t] * D*(D + 1) / 2;
    }

    for (int d = 0; d < D; d++)
    {
        T[d] = d % NUM_TYPE;
        score += getDeltaScore(d, D, C, T, S);
    }

//    int fullscore = getFullScore(D, C, T, S);
//    assert(fullscore==score);

    double time = 0.0;
    double limit = 1.8;


    const double BEGIN_TEMP = 1500;
    const double END_TEMP = 100;
    double temp = BEGIN_TEMP;

    long long step;
    for (step = 0; time < limit; step++)
    {
        if (step % 10000 == 0)
        {
            time = duration_cast<microseconds>(system_clock::now() - start).count() * 1e-6;

            const double progressRatio = min(time / limit, 1.0);
            temp = BEGIN_TEMP + (END_TEMP - BEGIN_TEMP) * 1.0;
        }

        if (nextDouble() > 0.5) // step % 2 == 0)
        {
            //  1日のコンテストの種類を変えてみる
            int d = xor128() % D;
            int t = xor128() % 26;
            int backupT = T[d];
            int deltaScore = 0;

            deltaScore -= getDeltaScore(d, D, C, T, S);
            T[d] = t;
            deltaScore += getDeltaScore(d, D, C, T, S);

            if (exp(deltaScore / temp) > nextDouble())
            {
                score += deltaScore;
            }
            else
            {
                T[d] = backupT;
            }
        }
        else
        {
            //  1週間以内のコンテストd0とd1を交換してみる
            int d0 = xor128() % D;
            int d1 = d0 + xor128() % 20 - 10;		// d1
            if (d1 != d0 && 0 <= d1 && d1 < D)
            {
                int deltaScore = 0;

                deltaScore -= getDeltaScore(d0, D, C, T, S);
                deltaScore -= getDeltaScore(d1, D, C, T, S);
                swap(T[d0], T[d1]);
                deltaScore += getDeltaScore(d0, D, C, T, S);
                deltaScore += getDeltaScore(d1, D, C, T, S);

                if (exp(deltaScore / temp) > nextDouble())
                {
                    score += deltaScore;
                }
                else
                {
                    swap(T[d0], T[d1]);
                }
            }
        }
    }

    for (int t : T)
    {
        cout << t + 1 << endl;
    }

    cerr << "score: " << max(0, score + 1000000) << endl;
    cerr << "step: " << step << endl;
}


Measured memory_bytes: 4388