#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
template <typename T> istream &operator>>(istream &is, vector<T> &v) {
    for(T &in : v)
        is >> in;
    return is;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
    for(int i = 0; i < (int)v.size(); i++)
        os << (i ? " " : "") << v[i];
    return os;
}
/*-------------------------------------------*/

int D;
int c[26];
int s[365][26];

void input() {
    cin >> D;
    rep(i, 26) cin >> c[i];
    rep(d, D) rep(i, 26) cin >> s[d][i];
}

int compute_score(const vector<int> &v) {
    int ret = 0;
    int last[26]{};
    rep(d, v.size()) {
        ret -= (d + 1 - last[v[d]]) * (d - last[v[d]]) / 2 * c[v[d]];
        ret += s[d][v[d]];
        last[v[d]] = d + 1;
    }
    rep(i, 26) ret -= (D + 1 - last[i]) * (D - last[i]) / 2 * c[i];
    return ret;
}

inline int cost(int d) { return d * (d - 1) / 2; }

struct State {
    vector<int> ret;
    int score;
    set<int> st[26];
    State(const vector<int> &v) {
        ret = v;
        score = compute_score(ret);
        rep(i, 26) {
            st[i].insert(-1);
            st[i].insert(D);
        }
        rep(d, D) st[v[d]].insert(d);
    }
    void chenge(int d, int q) {
        auto it1 = --st[ret[d]].lower_bound(d);
        auto it2 = st[ret[d]].upper_bound(d);
        score +=
            (cost(d - *it1) + cost(*it2 - d) - cost(*it2 - *it1)) * c[ret[d]];
        it1 = --st[q].lower_bound(d);
        it2 = st[q].upper_bound(d);
        score -= (cost(d - *it1) + cost(*it2 - d) - cost(*it2 - *it1)) * c[q];
        st[ret[d]].erase(d);
        st[q].insert(d);
        score += s[d][q];
        score -= s[d][ret[d]];
        ret[d] = q;
    }
};

void output(const vector<int> &v) {
    for(int e : v)
        cout << e + 1 << "\n";
    cerr << compute_score(v) << "\n";
}

// 焼きなまし
vector<int> solve() {
    const double T0 = 2e3;
    const double T1 = 6e2;
    const double TL = 1.9;
    vector<int> best_v(D);
    for(int &e : best_v)
        e = rand() % 26;
    State state(best_v);
    int cnt = 0;
    double T = T0;
    int best = state.score;
    while(true) {
        cnt++;
        if(cnt % 100 == 0) {
            double t = clock() / TL / CLOCKS_PER_SEC;
            if(t >= 1.) break;
            T = pow(T0, 1. - t) * pow(T1, t);
        }
        int old_score = state.score;
        if(rand() & 1) {
            int r = rand();
            int d = r % D;
            int old = state.ret[d];
            state.chenge(d, r % 26);
            if(old_score > state.score &&
               rand() < exp((state.score - old_score) / T) * RAND_MAX)
                state.chenge(d, old);
        } else {
            int d1 = rand() % (D - 1);
            int d2 = d1 + 1 + rand() % (min(d1 + 16, D) - d1 - 1);
            int a = state.ret[d1], b = state.ret[d2];
            state.chenge(d1, b);
            state.chenge(d2, a);
            if(old_score > state.score &&
               rand() < exp((state.score - old_score) / T) * RAND_MAX) {
                state.chenge(d1, a);
                state.chenge(d2, b);
            }
        }
        if(chmax(best, state.score)) best_v = state.ret;
    }
    return best_v;
}

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

    input();

    srand((unsigned)time(NULL));

    output(solve());

    return 0;
}

Measured memory_bytes: 4360