// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

int D;
int c[26];
int s[366][26];
int last[26];

set<int> idx[26];

ll calc(vi& ans) {
    ll score = 0;
    vi last(26);
    forn1(i, D) {
        int t = ans[i];

        last[t] = i;

        score += s[i][t];
        forn(j, 26) {
            score -= (i - last[j]) * c[j];
        }
    }

    return score;
}

ll sum(int i, int l, int r) {
    return c[i] * (r - l) * (r - l - 1) / 2;
}

ll update(int d, int to, vi& ans) {
    ll diff = 0;

    // from
    int from = ans[d];

    idx[from].erase(d);
    auto it = idx[from].upper_bound(d);
    int nxt = -1, prv = -1;
    if (it != idx[from].end()) {
        nxt = *it;
    }
    it--;
    prv = *it;

    diff += sum(from, prv, d);
    diff += sum(from, d, nxt);
    diff -= sum(from, prv, nxt);

    diff -= s[d][from];
    idx[from].insert(d);

    // to
    it = idx[to].upper_bound(d);
    nxt = -1, prv = -1;
    if (it != idx[to].end()) {
        nxt = *it;
    }
    it--;
    prv = *it;

    diff -= sum(to, prv, d);

    diff -= sum(to, d, nxt);
    diff += sum(to, prv, nxt);

    diff += s[d][to];

    return diff;
}

vi greedy() {
    vi ans = { 0 };
    ll score = 0;
    forn1(i, D) {
        ll v = LLONG_MIN;
        int ansi = -1;

        forn(j, 26) {
            ll x = s[i][j];
            forn(k, 26) {
                if (k != j) {
                    x -= (i - last[k]) * c[k];
                }
            }

            if (v < x) {
                v = x;
                ansi = j;
            }
        }

        score += v;
        last[ansi] = i;
        idx[ansi].insert(i);
        ans.push_back(ansi);
    }

    return ans;
}

vi random_ans() {
    random_device rd;
    mt19937 gen(rd());
    uniform_int_distribution<> k(0, 25);

    vi ans = { 0 };
    forn1(i, D) {
        int y = k(gen);
        ans.push_back(y);
        idx[y].insert(i);
    }

    return ans;
}

void improve(vi& ans) {

    random_device rd;
    mt19937 gen(rd());
    uniform_int_distribution<> d(1, D), k(0, 25);

    forn(i, 100000) {
        int x = d(gen), y = k(gen);

        if (ans[x] == y) continue;

        //ll score = calc(ans);
        ll diff = update(x, y, ans);

        if (diff > 0) {
            idx[ans[x]].erase(x);
            idx[y].insert(x);
            ans[x] = y;
            //assert(calc(ans) == score + diff);
        }
    }

    //assert(ans.size() == D + 1);
}

int main() {
    fastio();

    cin >> D;
    forn(i, 26) cin >> c[i];
    forn1(i, D) forn(j, 26) cin >> s[i][j];

    forn(i, 26) {
        idx[i].insert(0);
        idx[i].insert(366);
    }

    vi ans = greedy();
    improve(ans);
    ll score = calc(ans);

    forn(i, 10) {
        forn(i, 26) {
            idx[i].clear();
            idx[i].insert(0);
            idx[i].insert(366);
        }
        vi temp = random_ans();
        improve(temp);
        ll s = calc(temp);
        if (s > score) {
            ans = temp;
            score = s;
        }
    }

    for (int i = 1; i <= D; i++) {
        cout << (ans[i] + 1) << endl;
    }
}


Measured memory_bytes: 3676