#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int D;
vi c(26);
vector<vector<ll>> S(365, vector<ll>(26));
vi ans(365);

vector<set<int>> used_d(26), used_d_neg(26);

ll eval_all() {
    vi last(26, 0);

    REP(i, 26) {
        used_d[i].insert(0);
        used_d[i].insert(D + 1);
        used_d_neg[i].insert(0);
        used_d_neg[i].insert(-D - 1);
    }

    ll score = 0;
    REP(i, D) {
        int t = ans[i];

        int d = i + 1;

        used_d[t].insert(d);
        used_d_neg[t].insert(d);

        score += S[i][t];
        last[t] = d;

        REP(j, 26) {
            score -= c[j] * (d - last[j]);
        }
    }

    return score;
}

int get_idx(const set<int>& s, int d) {
    return *s.lower_bound(d);
}

ll calc(int d, int cost) {
    return (ll)cost * d * (d + 1) / 2;
}

bool update(int d, int q) {
    ll res = 0;

    int p = ans[d - 1];

    res += S[d - 1][q] - S[d - 1][p];

    int p_prev = -get_idx(used_d_neg[p], -d + 1);
    int p_next = get_idx(used_d[p], d + 1);
    int q_prev = -get_idx(used_d_neg[q], -d + 1);
    int q_next = get_idx(used_d[q], d + 1);

    res += calc(p_next - d - 1, c[p]);
    res += calc(d - p_prev - 1, c[p]);
    res -= calc(p_next - p_prev - 1, c[p]);

    res += calc(q_next - q_prev - 1, c[q]);
    res -= calc(q_next - d - 1, c[q]);
    res -= calc(d - q_prev - 1, c[q]);

    if (res > 0) {
        ans[d - 1] = q;
        used_d[p].erase(d);
        used_d_neg[p].erase(-d);
        used_d[q].insert(d);
        used_d_neg[q].insert(-d);
    }

    return res > 0;
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    cin >> D;

    REP(i, 26) cin >> c[i];

    vi last(26, 0);
    REP(i, D) {
        vll s(26);
        REP(j, 26) {
            cin >> s[j];
            S[i][j] = s[j];
        }

        vll p(26);
        ll p_all = 0;
        REP(j, 26) {
            p[j] = c[j] * (i + 1 - last[j]);
            p_all += p[j];
        }

        REP(j, 26) {
            s[j] -= p_all - p[j];
        }

        int idx = max_element(ALL(s)) - s.begin();

        last[idx] = i + 1;
        ans[i] = idx;
    }

    ll score = eval_all();

    std::random_device rd;
    std::mt19937 mt(rd());
    std::uniform_int_distribution<int> d_rng(1, D);
    std::uniform_int_distribution<int> t_rng(0, 25);

    REP(i, 1e7) {
        int d = d_rng(mt), t = t_rng(mt);
        if (ans[d] == t) {
            --i;
            continue;
        }

        update(d, t);
    }

    REP(i, D) {
        print(ans[i] + 1);
    }

}


Measured memory_bytes: 3832