#include <queue>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iostream>
#include <fstream>
#include <chrono>
#include <random>

using namespace std;

auto start_time = chrono::system_clock::now();
minstd_rand rnd(start_time.time_since_epoch().count());

inline bool timeout(int ms) {
    auto delta = chrono::system_clock::now() - start_time;
    return chrono::duration_cast<chrono::milliseconds>(delta).count() >= ms;
}

inline int spent() {
    auto delta = chrono::system_clock::now() - start_time;
    return chrono::duration_cast<chrono::milliseconds>(delta).count();
}

inline int pct(int ms) {
    auto delta = chrono::system_clock::now() - start_time;
    return 100.0 * chrono::duration_cast<chrono::milliseconds>(delta).count() / ms;
}

class Pts {
public:
    Pts(int n, int d) : mem(n) {
        for (auto &a : mem) {
            a.reserve(d + 1);
            a.push_back(-1);
            a.push_back(d);
        }
    }

    inline pair<int, int> get(int t, int k) {
        auto &a = mem[k];
        auto i = lower_bound(a.begin(), a.end(), t);
        if (*i == t) return {*(i - 1), *(i + 1)};
        else return {*(i - 1), *i};
    }

    inline void set(int t, int i) {
        auto &b = mem[i];
        auto j = lower_bound(b.begin(), b.end(), t);
        b.insert(j, t);
    }

    inline void unset(int t, int i) {
        auto &a = mem[i];
        auto j = find(a.begin(), a.end(), t);
        a.erase(j);
    }

private:
    vector<vector<int>> mem;
};

const int n = 26;

class Solution {
public:
    Solution(int n, int d) :
            n(n), d(d), cost(0),
            c(n), s(d, vector<int>(n)),
            res(d), pts(n, d) {

        for (auto &x : c) cin >> x;

        for (int t = 0; t < d; t++) {
            for (int i = 0; i < n; i++) {
                cin >> s[t][i];
            }
        }

        reset();
    }

    void reset() {
        Pts np(n, d);
        pts = np;
        cost = 0;
        for (int t = 0; t < d; t++) {
            int i = max_element(s[t].begin(), s[t].end()) - s[t].begin();
            res[t] = i;
            cost += s[t][i];
            int q = pts.get(t, i).first;
            cost -= c[i] * (t - q - 1) * (t - q) / 2;
            pts.set(t, i);
        }

        for (int i = 0; i < n; i++) {
            int q = pts.get(d, i).first;
            cost -= c[i] * (d - q - 1) * (d - q) / 2;
        }
    }

    inline int64_t estimate(int t, int j) {
        int i = res[t];
        int64_t delta = s[t][j] - s[t][i];
        {
            auto p = pts.get(t, i);
            int l = t - p.first - 1;
            int r = p.second - t - 1;
            delta += c[i] * (l * (l + 1) + r * (r + 1) - (l + r + 1) * (l + r + 2)) / 2;
        }
        {
            auto p = pts.get(t, j);
            int l = t - p.first - 1;
            int r = p.second - t - 1;
            delta -= c[j] * (l * (l + 1) + r * (r + 1) - (l + r + 1) * (l + r + 2)) / 2;
        }
        return delta;
    }

    inline void change(int t, int j, int64_t delta) {
        int i = res[t];
        res[t] = j;
        pts.unset(t, i);
        pts.set(t, j);
        cost += delta;
    }

    inline vector<int> &result() {
        return res;
    }

    inline int64_t get_cost() {
        return cost;
    }

private:
    int n;
    int d;
    int64_t cost;
    vector<int> c;
    vector<vector<int>> s;
    vector<int> res;
    Pts pts;
};

void solver(int d, Solution &solution, int a, double b, int c) {
    start_time = chrono::system_clock::now();

    int cnt = 0;
    const int tmt = 1950;
    double p = 1;

    vector<int> bestr(d);
    int64_t bestc = INT64_MIN;
    int64_t max_delta;
    int64_t avg_delta = 1;
//    int resets = 0;
//    int sw1 = 0;
//    int sw2 = 0;
//    int rn = 0;

    while (cnt % (1 << 5) || !timeout(tmt)) {
        max_delta = 1;
        unsigned bs = rnd() % 10007;
        if (cnt % (1 << 5) == 0) {
            double left = max(1.0, 100.0 - pct(tmt));
            p = left / 100;

//            if (cnt % (1 << 10) == 0) {
//                cerr << "epoch: " << cnt << "(" << left << "%): " << solution.get_cost()
//                     << " sw1 " << sw1 << " sw2 " << sw2 << " rn " << rn
//                     << " - p=" << a * p / 100.0 << "% " << avg_delta << " : " << resets << "\n";
//                resets = 0;
//            }

            if (bestc - solution.get_cost() > b * avg_delta) {
                for (int t = 0; t < d; t++) {
                    int i = bestr[t];
                    auto delta = solution.estimate(t, i);
                    solution.change(t, i, delta);
                }
//                resets += 1;
            }
            if (solution.get_cost() > bestc) {
                bestc = solution.get_cost();
                bestr = solution.result();
            }
        }

        if (bs < a * p) {
            int t = rnd() % d;
            int i = rnd() % n;
            int64_t delta = solution.estimate(t, i);
            solution.change(t, i, delta);
            max_delta = max(max_delta, delta);
//            rn++;
        }
        if (bs < c) {
            for (int t = 0; t < d; t++) {
                unsigned i = rnd() % n;
                int64_t delta = solution.estimate(t, i);
                if (delta > 0) {
                    solution.change(t, i, delta);
                    max_delta = max(max_delta, delta);
//                    sw1++;
                }
            }
        } else {
            int r = rnd() % 16 + 1;
            for (int t = 0; t + r < d; t++) {
                unsigned q = t + r;
                int i = solution.result()[t];
                int j = solution.result()[q];
                int64_t d1 = solution.estimate(t, j);
                solution.change(t, j, d1);
                int64_t d2 = solution.estimate(q, i);
                if (d1 + d2 > 0) {
                    solution.change(q, i, d2);
                    max_delta = max(max_delta, d1);
                    max_delta = max(max_delta, d2);
//                    sw2++;
                } else {
                    solution.change(t, i, -d1);
                }
            }
        }
        if (max_delta > 0) avg_delta = 0.9 * avg_delta + 0.1 * max_delta;
        cnt++;
    }

    if (solution.get_cost() < bestc) {
        for (int t = 0; t < d; t++) {
            int i = bestr[t];
            auto delta = solution.estimate(t, i);
            solution.change(t, i, delta);
        }
    }

//    cerr << "final (" << a / 100.0 << "% : " << b << ") " << spent() << " ms: " << solution.get_cost() << '\n';

}

int main() {
    ios_base::sync_with_stdio(false);

    int d;
    cin >> d;

    Solution solution(n, d);

    solver(d, solution, 2000, 5, 5000);

    for (auto &x : solution.result()) cout << x + 1 << '\n';

    return 0;
}


Measured memory_bytes: 3764