#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);

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

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

        used_d[t].insert(i);

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

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

    return score;
}

int get_idx(const set<int>& s, int d) {
    auto it = s.lower_bound(d);
    if (it != s.end()) return *it;
    else return 0;
}

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];

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

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

    p_next = p_next == 0 ? 365 : p_next;
    q_next = q_next == 0 ? 365 : q_next;

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

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

    if (res > 0) {
        ans[d] = q;
        used_d[p].erase(d);
        used_d[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(0, D-1);
    std::uniform_int_distribution<int> t_rng(0, 25);

    REP(i, 3e5) {
        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: 3768