#include <bits/stdc++.h>
using namespace std;
using ll = long long;

mt19937 mt;

struct Settings {
    int D;
    int TMAX = 26;
    vector<ll> C;
    vector<vector<ll>> S;
    Settings(int d, vector<ll>& c, vector<vector<ll>>& s) : D(d), C(c), S(s) {}
};

struct Schedule {
    Settings& ss;
    vector<int> T;  // T[d]: type of day d+1, T[d]=-1:invalid
    vector<set<int>> ts; // ts[ty]: indexes of ty
    ll score = 0;
    Schedule(Settings& ss) : ss(ss) {
        ts.assign(ss.TMAX, set<int>());
        T.assign(ss.D, -1);
        score = 0;
        for ( int t = 0; t < ss.TMAX; t++ ) {
            ts[t].insert(-1);
            int dd = ss.D+1;
            score -= dd*(dd-1)/2 * ss.C[t];
            ts[t].insert(ss.D);
        }
    }
    // d+1日目の種類をq+1に変える
    void change(int d, int q) {
        // remove
        if ( T[d] >= 0 ) {
            auto p = ts[T[d]].find(d);
            auto p_prev = prev(p), p_next = next(p);
            score -= (d-*p_prev) * (*p_next-d) * ss.C[T[d]];
            score -= ss.S[d][T[d]];
            ts[T[d]].erase(d);
            T[d] = -1;
        }
        // add
        if ( q >= 0 ) {
            T[d] = q;
            ts[T[d]].insert(d);
            auto p = ts[T[d]].find(d);
            auto p_prev = prev(p), p_next = next(p);
            score += (d-*p_prev) * (*p_next-d) * ss.C[T[d]];
            score += ss.S[d][T[d]];
        }
    }
};

// テストデータ作成
Settings CreateSettings() {
    uniform_int_distribution<int> rnd_c(0, 100);
    uniform_int_distribution<int> rnd_s(0, 20000);
    ll D = 365;
    vector<ll> C(26);
    for ( int i = 0; i < 26; i++ ) {
        C[i] = rnd_c(mt);
    }
    vector<vector<ll>> S(D, vector<ll>(26));
    for ( int i = 0; i < D; i++ ) {
        for ( int j = 0; j < 26; j++ ) {
            S[i][j] = rnd_s(mt);
        }
    }
    Settings ss(D,C,S);
    return ss;
}

// 貪欲法 dd:[0,D)の順列
void greedy(Schedule& sch, vector<int>& dd) {
    auto& ss = sch.ss;
    vector<int> T(ss.D,-1);
    for ( int d : dd ) {
        ll sc = -(1LL<<60);
        for ( int q = 0; q < ss.TMAX; q++ ) {
            sch.change(d,q);
            if ( sc < sch.score ) {
                T[d] = q;
                sc = sch.score;
            }
        }
        sch.change(d,T[d]);
    }
}
// 貪欲法 日付順ランダム
void greedy_rand(Schedule& sch, int cnt = 1) {
    vector<int> dd(sch.ss.D);
    for ( int i = 0; i < sch.ss.D; i++ ) dd[i] = i;
    while ( cnt-- ) {
        shuffle(dd.begin(), dd.end(), mt);
        greedy(sch, dd);
    }
}
void trial_rand(Schedule& sch, int sz = 1, int cnt = 1) {
    uniform_int_distribution<int> rnd_d(0, sch.ss.D-1);
    uniform_int_distribution<int> rnd_t(0, sch.ss.TMAX-1);
    while ( cnt-- ) {
        ll sc = sch.score;
        stack<tuple<int,int>> old;
        int d, t;
        for ( int i = 0; i < sz; i++ ) {
            d = rnd_d(mt), 
            t = rnd_t(mt);
            old.push(make_tuple(d, sch.T[d]));
            sch.change(d, t);
        }
        if ( sch.score < sc ) {
            while ( !old.empty() ) {
                tie(d,t) = old.top();
                old.pop();
                sch.change(d, t);
            }
        } else {
            while ( !old.empty() ) old.pop();
        }
    }
}


ll test_main() {
    auto t_start = chrono::system_clock::now();
    Settings ss = CreateSettings();
    Schedule sch(ss);
    // 初期値設定
    // for ( int i = 0; i < 20; i++ ) {
    //     cout << i << ": " << sch.score << ", " << sch2.score << ", " << sch3.score << "\n";
    //     greedy_rand(sch);
    // }
    // cout << "end" << ": " << sch.score << ", " << sch2.score << ", " << sch3.score << "\n";

    int out_id = 0;
    auto out_score = [&]() {
        cout << out_id++ << ": " << sch.score << "\n";
    };
    out_score();
    // 初期値設定
    greedy_rand(sch);
    out_score();
    greedy_rand(sch);
    out_score();
    greedy_rand(sch);
    out_score();
    greedy_rand(sch);
    out_score();
    greedy_rand(sch);
    out_score();
    cout << "\n";
    trial_rand(sch, 1, 1000);
    out_score();
    trial_rand(sch, 1, 1000);

    // for ( int d = 0; d < ss.D; d++ ) {
    //     cout << sch.T[d]+1 << "\n";
    // }   
    
    ll ans = 0;
    return ans;
}

ll solve_main() {
    auto t_start = chrono::system_clock::now();
    mt = mt19937(0);
    // input
    ll D;
    cin >> D;
    vector<ll> C(26);
    for ( int i = 0; i < 26; i++ ) cin >> C[i];
    vector<vector<ll>> S(D, vector<ll>(26));
    for ( int i = 0; i < D; i++ ) {
        for ( int j = 0; j < 26; j++ ) cin >> S[i][j];
    }
    Settings ss(D,C,S);
    vector<Schedule> sch = {Schedule(ss), Schedule(ss), Schedule(ss)};
    ll sc = -(1LL<<60);
    int mi = -1;
    for ( int i = 0; i < 3; i++ ) {
        greedy_rand(sch[i], 5);
        trial_rand(sch[i],1, 3000);
        if ( sc < sch[i].score ) {
            sc = sch[i].score;
            mi = i;
        }
    }
    // cout << sc << "\n";

    for ( int d = 0; d < ss.D; d++ ) {
        cout << sch[mi].T[d]+1 << "\n";
    }
    return 0;
}

int main() {
    mt = mt19937(0);
    // test_main();
    solve_main();
    return 0;
}

Measured memory_bytes: 3896