#include <algorithm>
#include <chrono>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;
typedef long long Int;

#define KIND 26
//#define KIND 2
Int D;
Int c[KIND];
Int s[400][KIND];
Int last[KIND];

vector<Int> best_t;

std::chrono::time_point<std::chrono::steady_clock> start;

double dice()
{
    return double(rand()) / RAND_MAX;
}

double prob(double rest)
{
    return rest * 1e-3;
}

Int range(Int l, Int r)
{
    Int len = r - l - 1;
    return -len * (len + 1) / 2;
}

void tic()
{
    start = std::chrono::steady_clock::now();
}

double toc()
{
    auto now = std::chrono::steady_clock::now();
    std::chrono::duration<double> duration = now - start;
    return duration.count();
}

struct ContestInfo {
    set<Int> held[KIND];
    vector<Int> t;
    int D;
    Int score = 0;
    ContestInfo(int D) : D(D)
    {
        t.resize(D, -1);
        for (int i = 0; i < KIND; i++) {
            held[i].insert(-1);
            held[i].insert(D);
            score += c[i] * range(-1, D);
        }
    }

    void add(int d, int q)
    {
        if (t[d] != -1) {
            cout << "Add failed" << endl;
            exit(1);
        }
        t[d] = q;
        score += s[d][q];
        held[q].insert(d);
        auto it = held[q].find(d);
        auto rit = next(it);
        auto lit = prev(it);
        score -= c[q] * range(*lit, *rit);
        score += c[q] * range(*it, *rit);
        score += c[q] * range(*lit, *it);
    }

    void erase(int d)
    {
        if (t[d] == -1) {
            cout << "erase failed" << endl;
            exit(1);
        }
        int q = t[d];
        t[d] = -1;
        score -= s[d][q];
        auto it = held[q].find(d);
        auto rit = next(it);
        auto lit = prev(it);
        score += c[q] * range(*lit, *rit);
        score -= c[q] * range(*it, *rit);
        score -= c[q] * range(*lit, *it);
        held[q].erase(it);
    }

    void change(int d, int q)
    {
        erase(d);
        add(d, q);
    }

    void output()
    {
        for (int i = 0; i < D; i++) {
            cout << t[i] + 1 << endl;
        }
    }

    void save() { best_t = t; }
};

Int calc_score(vector<Int> t)
{
    Int score = 0;
    fill(last, last + 26, -1);
    for (int d = 0; d < D; d++) {
        score += s[d][t[d]];
        last[t[d]] = d;
        for (int i = 0; i < KIND; i++) {
            score -= c[i] * (d - last[i]);
        }
        // cout << score << endl;
    }
    return score;
}

int main()
{
    cin >> D;
    for (Int i = 0; i < KIND; i++) {
        cin >> c[i];
    }
    for (Int d = 0; d < D; d++) {
        for (Int i = 0; i < KIND; i++) {
            cin >> s[d][i];
        }
    }

    tic();

    Int BEAMW = 5;
    vector<ContestInfo> beam;

    Int best_score = -1e10;

    for (int i = 0; i < BEAMW; i++) {
        beam.emplace_back(D);
        for (int d = 0; d < D; d++) {
            Int t;
            t = rand() % KIND;
            beam.back().add(d, t);
        }
        if (best_score < beam[i].score) {
            beam[i].save();
            best_score = beam[i].score;
        }
    }

    while (toc() < 1.9) {
        Int d, q;
        d = rand() % D;
        int TRIAL = 3;
        typedef pair<Int, pair<int, pair<int, int>>> P;
        priority_queue<P> pq;
        for (int i = 0; i < BEAMW; i++) {
            auto &ci = beam[i];
            for (int _j = 0; _j < TRIAL; _j++) {
                int new_q = rand() % KIND;
                int d = rand() % D;
                ci.change(d, new_q);
                pq.push({ci.score, {i, {d, new_q}}});
            }
        }
        vector<ContestInfo> new_beam;
        for (int i = 0; i < BEAMW; i++) {
            auto change = pq.top();
            pq.pop();
            int ind = change.second.first;
            int d = change.second.second.first;
            int q = change.second.second.second;
            beam[ind].change(d, q);
            if (best_score < beam[ind].score) {
                beam[ind].save();
                best_score = beam[ind].score;
            }
            new_beam.push_back(beam[ind]);
        }
        beam = new_beam;
    }

    for (int i = 0; i < D; i++)
        cout << best_t[i] + 1 << endl;
    return 0;
}

Measured memory_bytes: 3532