#include <string>
#include <iostream>
#include <stack>
#include <queue> // priority_queue も入ってる
#include <set>   // 要素数は size() で取得 multisetもある
#include <map>
#include <array> // sizeはコンパイル時定数で固定
#include <vector>
#include <numeric>   // accumulate, gcd
#include <algorithm> // count_ifに必要
#include <iomanip>   // cout << setprecision(15) << x で小数の出力精度を指定
#include <tuple>
#include <utility> //pair
#include <cmath>
#include <random>

using namespace std;
// 問題が起こるまでintは使用禁止2020-04-13
using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)

template <class InputIterator, class T>
bool contains_itr(InputIterator iterator, const T &value)
{
    if (find(iterator.begin(), iterator.end(), value) == iterator.end())
        return false;
    else
        return true;
}

template <class T>
bool contains_set(set<T> st, const T &value)
{
    if (st.find(value) == st.end())
    {
        return false;
    }
    else
    {
        return true;
    }
}

template <class InputIterator>
auto sum(InputIterator iterator)
{
    return accumulate(iterator.begin(), iterator.end(), 0);
}

// endは排他的(exclusive)なので注意
vector<ll> range(ll begin, ll end)
{
    vector<ll> result;
    for (ll i = begin; i < end; ++i)
    {
        result.push_back(i);
    }
    return result;
}

// =========ここまでテンプレ============

random_device seed_gen;
default_random_engine engine(seed_gen());
uniform_int_distribution<> dist(0, 100000);

int main()
{
    ll d;
    cin >> d;
    array<ll, 26> c;
    rep(i, 26) cin >> c[i];
    vector<array<ll, 26>> s(d, array<ll, 26>());
    rep(i, d)
    {
        rep(j, 26) cin >> s[i][j];
    }
    // ここまでA問の入力と同じ

    vector<ll> superBestT;
    ll superBestScore = LLONG_MIN;

    rep(k, 800)
    {
        vector<ll> bestT;
        ll bestScore = LLONG_MIN;

        vector<ll> t(d);
        rep(i, d)
        {
            t[i] = dist(engine) % 26;
        };

        array<ll, 26> last;
        rep(i, 26) last[i] = -1;
        ll satis = 0;
        rep(i, d)
        {
            satis += s[i][t[i]];
            last[t[i]] = i;
            rep(j, 26)
            {
                satis -= c[j] * (i - last[j]);
            }
        }
        // ここまで問題B

        // ll m;
        // cin >> m;
        // vector<ll> targetD(m);
        // vector<ll> q(m);
        // rep(i, m)
        // {
        //     cin >> targetD[i];
        //     --targetD[i];
        //     cin >> q[i];
        //     --q[i];
        // }

        ll m = 10000;

        rep(i, m)
        {
            ll oldSatis = satis;
            // コンテストを休む
            ll cancelledDay = dist(engine) % d;
            ll cancelledContest = t[cancelledDay];
            satis -= s[cancelledDay][cancelledContest];
            ll lastHeldDay = -1;
            for (ll j = cancelledDay - 1; j >= 0; --j)
            {
                if (t[j] == cancelledContest)
                {
                    lastHeldDay = j;
                    break;
                }
            }
            ll nextHoldDay = d;
            for (ll j = cancelledDay + 1; j <= d - 1; ++j)
            {
                if (t[j] == cancelledContest)
                {
                    nextHoldDay = j;
                    break;
                }
            }
            satis -= (c[cancelledContest] * (cancelledDay - lastHeldDay)) * (nextHoldDay - cancelledDay);

            // コンテストを開催する
            ll changedDay = cancelledDay;
            ll heldContest = dist(engine) % 26;
            satis += s[changedDay][heldContest];

            lastHeldDay = -1;
            for (ll j = changedDay - 1; j >= 0; --j)
            {
                if (t[j] == heldContest)
                {
                    lastHeldDay = j;
                    break;
                }
            }
            nextHoldDay = d;
            for (ll j = changedDay + 1; j <= d - 1; ++j)
            {
                if (t[j] == heldContest)
                {
                    nextHoldDay = j;
                    break;
                }
            }
            satis += (c[heldContest] * (changedDay - lastHeldDay)) * (nextHoldDay - changedDay);

            // if (i % 5000 == 0)
            //     cout << i << endl; // TODO: delete this!!

            // 記録
            if (satis > bestScore || dist(engine) % 10000 < 5)
            {
                if (satis > bestScore)
                {
                    bestT = t;
                    bestScore = satis;
                    // if (i > 4000)
                    // cout << "modified! to: " << bestScore << " at: " << i << endl; // TODO: delete this!!!
                }
                // データ調整
                t[changedDay] = heldContest;
            }
            else
            {
                satis = oldSatis;
            }
        }
        if (bestScore > superBestScore)
        {
            superBestScore = bestScore;
            superBestT = bestT;
        }
    }
    rep(i, superBestT.size())
    {
        cout << (superBestT[i] + 1) << endl;
    }
    // cout << superBestScore << "delete this!!!!" << endl; // TODO: delete this!!
}

Measured memory_bytes: 3260