#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "../debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

typedef std::chrono::time_point<std::chrono::system_clock> time_type;
inline time_type tick() {
    return std::chrono::system_clock::now();
}
inline double to_duration(time_type start, time_type end) {
    return std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() / 1000.0;
}

class Timer {
private:
    time_type _start;
    time_type _end;

public:
    Timer()
        : _start(), _end() {
    }

    void start() {
        _start = tick();
    }

    double now() {
        _end = tick();
        return to_duration(_start, _end);
    }
};

uint32_t xor32(void) {
    static uint32_t y = 2463534242;
    y = y ^ (y << 13);
    y = y ^ (y >> 17);
    return y = y ^ (y << 5);
}

double rand01() {
    return (double)xor32() / numeric_limits<uint32_t>::max();
}

class Schedular {
public:
    int D;
    vi c;
    vvi s;
    vvi hist;
    vi t;
    Timer timer;
    Schedular(int d) : D(d), c(26), s(D, vi(26)), t(D), hist(26) {
        timer.start();
        cin >> c;
        REP(i, D)
        REP(j, 26) {
            cin >> s[i][j];
        }
    }

    void out() {
        REP(i, D) {
            cout << t[i] + 1 << endl;
        }
    }

    void init() {
        vi last(26, -1);
        int score = 0;
        REP(d, D) {
            REP(j, 26) {
                score -= c[j] * (d - last[j]);
            }
            int mx = 0;
            int ind = 0;
            REP(j, 26) {
                int diff = s[d][j] + c[j] * (d - last[j]);
                if (diff > mx) {
                    mx = diff;
                    ind = j;
                }
            }
            score += s[d][ind] + c[ind] * (d - last[ind]);
            last[ind] = d;
            t[d] = ind;
        }
    }

    int calcScore(int dmax) {
        dmax = min(dmax, D - 1);
        vi last(26, -1);
        int score = 0;
        REP(d, dmax + 1) {
            score += s[d][t[d]];
            last[t[d]] = d;
            REP(j, 26) {
                score -= c[j] * (d - last[j]);
            }
        }
        return score;
    }

    int replace(int d, int q) {
        assert(0 <= d && d <= D);
        assert(0 <= q && q <= 26);
        int diff = 0;
        int p = t[d];
        vi::iterator now = find(ALL(hist[p]), d);
        diff -= s[d][p] + (*now - *prev(now)) * c[p] * (*next(now) - *now);
        hist[p].erase(now);

        auto nxt = lower_bound(ALL(hist[q]), d);
        now = hist[q].insert(nxt, d);
        diff += s[d][q] + (*now - *prev(now)) * c[q] * (*next(now) - *now);
        t[d] = q;
        return diff;
    }

    int swapNeibor(int d1, int d2) {
        int a = t[d1];
        int b = t[d2];
        int diff = replace(d1, b) + replace(d2, a);
        return diff;
    }

    void build() {
        REP(i, 26)
        hist[i].push_back(-1);
        REP(i, D) {
            hist[t[i]].push_back(i);
        }
        REP(i, 26)
        hist[i].push_back(D);
        int score = calcScore(D - 1);
        double tlimit = 1.9;
        double T0 = 2e3;
        double T1 = 6e2;
        double Tnow = 0;
        auto nextT = [&](double T) {
            double t = timer.now() / tlimit;
            return pow(T0, 1.0 - t) * pow(T1, t);
        };
        int cnt = 0;
        while (timer.now() < tlimit) {
            if (++cnt % 100 == 0) {
                Tnow = nextT(Tnow);
            }
            int flag = xor32() % 2;
            if (flag) {
                int d = xor32() % D, q = xor32() % 26;
                int p = t[d];
                int diff = replace(d, q);
                double prob = exp(diff / Tnow);
                if (diff < 0 && rand01() > prob) {
                    replace(d, p);
                } else {
                    score += diff;
                    if (diff > 0)
                        dump(timer.now(), score);
                }
            } else {
                int interval = xor32() % 26 + 1;
                int d1 = xor32() % (D - interval);
                int d2 = d1 + interval;
                int diff = swapNeibor(d1, d2);
                double prob = exp(diff / Tnow);
                if (diff < 0 && rand01() > prob) {
                    swapNeibor(d1, d2);
                } else {
                    score += diff;
                    if (diff > 0)
                        dump(timer.now(), score);
                }
            }
            //assert(score == calcScore(D));
        }
        dump(score);
    }
};

signed main() {
    cin >> D;
    Schedular s(D);
    s.init();
    s.build();
    s.out();
}

Measured memory_bytes: 4236