#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

const int ids = 26;

/*
ll calc(vector<vector<int>> &score, vector<int> &del, vector<int> &selected) {
    vector<int> last(ids, 0);
    ll res = 0;
    REP(i, 0, selected.size()) {
        int s = selected[i];
        last[s] = i + 1;
        res += score[i][s];
        REP(j, 0, ids) {
            res -= del[j] * (i + 1 - last[j]);
        }
    }
    return res;
}
*/

ll calc(vector<vector<int>> &score, vector<int> &del, vector<int> &selected) {
    vector<int> last(ids, 0);
    ll res = 0;
    REP(i, 0, selected.size()) {
        int s = selected[i];
        int prev = last[s];
        int cur = i + 1;
        res -= del[s] * (cur - prev + 1) * (cur - prev) / 2;

        last[s] = cur;
        res += score[i][s];
    }
    REP(i, 0, ids) {
        int prev = last[i];
        int cur = score.size();
        res -= del[i] * (cur - prev + 1) * (cur - prev) / 2;
    }

    return res;
}

#include <random>
#include <ctime>

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int d;
    cin, d;

    vector<int> c(ids);
    REP(i, 0, ids) {
        cin, c[i];
    }
    auto score = make_v(d, ids, 0);
    REP(i, 0, d) {
        REP(j, 0, ids) {
            cin, score[i][j];
        }
    }

    const int steps = 2;
    const int repeat = 20000;
    const int trials = 50;
    vector<int> selected(d);

    auto rd = random_device();
    auto gen = mt19937(rd());
    uniform_int_distribution<int> contest(1, 26);
    uniform_int_distribution<int> days(1, d);

    {
        int a = time(NULL) % 1000;
        REP(i, 0, a) {
            gen();
        }
    }

    const ll inf = 1LL << 60;
    vector<int> best_selected(d);
    ll best_score = -inf;

    REP(_tt, 0, steps) {
        REP(i, 0, d) {
            selected[i] = contest(gen) - 1;
        }

        REP(_, 0, repeat) {
            ll s = -inf;
            int best_c, best_d;
            REP(_t, 0, trials) {
                int sc = contest(gen) - 1;
                int sd = days(gen) - 1;
                int save = selected[sd];
                selected[sd] = sc;
                ll tmp = calc(score, c, selected);
                if (chmax(s, tmp)) {
                    best_c = sc;
                    best_d = sd;
                }
                selected[sd] = save;
            }
            selected[best_d] = best_c;
            if ((_ + 1) % 100 == 0) {
                dump(s);
            }
        }

        ll sc = calc(score, c, selected);
        if (chmax(best_score, sc)) {
            best_selected = selected;
        }
    }

    REP(i, 0, d) {
        print(best_selected[i] + 1);
    }

    return 0;
}


Measured memory_bytes: 3672