#include "bits/stdc++.h"
using namespace std;

#define dump(...) DUMPOUT<<"  ";DUMPOUT<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<std::endl;DUMPOUT<<"    ";dump_func(__VA_ARGS__)
#define FOR(i,a,n) for(int i=(a);i<(n);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(j) (j).begin(), (j).end()
#define SZ(j) ((int)(j).size())

int D = 365;
const int T = 26;

vector<int> c(T);
vector<vector<int>> s(D, vector<int>(T)); 

long long eval(vector<int> out, int k) {
    long long score = 0;
    vector<int> last(T, 0);
    REP(d, (int)out.size()) {
        last[out[d]-1] = d+1;
        REP(i, T) {
            score -= (long long)(d+1 - last[i]) * c[i];
        }
        score += s[d][out[d]-1];
    }
    FOR(d, (int)out.size(), min(D, (int)out.size()+k)) {
        REP(i, T) {
            score -= (long long)(d+1 - last[i]) * c[i];
        }
    }

    return score;
}

long long compute_score(vector<int> out) {
    long long score = 0;
    vector<int> last(T, 0);
    REP(d, (int)out.size()) {
        last[out[d]-1] = d+1;
        REP(i, T) {
            score -= (long long)(d+1 - last[i]) * c[i];
        }
        score += s[d][out[d]-1];

        // cout << score << endl;
    }

    return score;
}

vector<int> greedy_cand(int k) {
    vector<int> out;
    REP(_, D) {
        int best_i = 1;
        long long max_score = -(1e18);
        FOR(i, 1, T+1) {
            out.emplace_back(i);
            long long score = eval(out, k);
            if (max_score < score) {
                max_score = score;
                best_i = i;
            }

            out.pop_back(); 
        }
        out.emplace_back(best_i);
    }

    return out;
}

vector<int> greedy() {
    vector<int> out = greedy_cand(13);
    long long max_eval = eval(out, 13);
    REP(k, 26) {
        vector<int> o = greedy_cand(k);
        long long eval_v = eval(o, k);
        if (max_eval < eval_v) {
            out = o;
            max_eval = eval_v;
        }
    }

    return out;
}

vector<int> local_search() { 
    std::random_device seed_gen;
    std::mt19937 engine(seed_gen());

    std::uniform_int_distribution<> dist(1, 26);
    std::uniform_int_distribution<> distD(0, D-1);
    std::uniform_int_distribution<> distD1(0, D-2);
    std::uniform_real_distribution<> distS(0, 1);
    vector<int> out(D);
    REP(i, D) out[i] = dist(engine);
    long long score = compute_score(out);
    double TL = 1950;
    chrono::system_clock::time_point  start, end;
    start = chrono::system_clock::now();
    end = std::chrono::system_clock::now();
    while (chrono::duration_cast<chrono::milliseconds>(end-start).count() < TL)
    {
        if (distS(engine) < 0.5) {
            int d = distD(engine);
            int q = dist(engine);
            int old = out[d];
            out[d] = q;
            long long new_score = compute_score(out);
            if (new_score < score) {
                out[d] = old;
            } else {
                score = new_score;
            }
        } else {
            int d1 = distD1(engine);
            std::uniform_int_distribution<> distD2(d1+1, min(D-1, d1+16));
            int d2 = distD2(engine);
            assert(0 <= d1 and d1 < D);
            assert(0 <= d2 and d2 < D);
            swap(out[d1], out[d2]);
            long long new_score = compute_score(out);
            if (new_score < score) {
                swap(out[d1], out[d2]);
            } else {
                score = new_score;
            }
        }
        
        end = std::chrono::system_clock::now();
    }

    return out;
}

vector<int> solve() {
    const long double T0 = 2e3;
    const long double T1 = 6e2;
    const double TL = 1950;

    vector<int> out(D);
    std::uniform_int_distribution<> dist(1, 26);
    std::random_device seed_gen;
    std::mt19937 engine(seed_gen());
    REP(i, D) out[i] = dist(engine);

    int cnt = 0;
    long double T = T0;
    long long best_score = compute_score(out);
    vector<int> best_out = out;
    chrono::system_clock::time_point  start, end;
    start = chrono::system_clock::now();
    end = std::chrono::system_clock::now();

    std::uniform_real_distribution<> distS(0, 1);
    std::uniform_int_distribution<> distD(0, D-1);
    std::uniform_int_distribution<> distD1(0, D-2);
    while (true)
    {
        cnt++;
        if (cnt%100 == 0) {
            double t = chrono::duration_cast<chrono::milliseconds>(end-start).count()/TL;
            if (t >= 1.0) break;
            T = pow(T, 1.0-t) * pow(T1, t);
        }

        long long old_score = compute_score(out);
        long long new_score;
        if (distS(engine) < 0.5) {
            int d = distD(engine);
            int old = out[d];
            out[d] = dist(engine);
            new_score = compute_score(out);
            if (old_score > new_score and !(distS(engine) < exp(new_score-old_score)/T)) {
                out[d] = old;    
            } 
        } else {
            int d1 = distD1(engine);
            std::uniform_int_distribution<> distD2(d1+1, min(D-1, d1+16));
            int d2 = distD2(engine);
            assert(0 <= d1 and d1 < D);
            assert(0 <= d2 and d2 < D);
            swap(out[d1], out[d2]);
            new_score = compute_score(out);
            if (old_score > new_score and !(distS(engine) < exp(new_score-old_score)/T)) { 
                swap(out[d1], out[d2]);
            }
        }

        if (best_score < new_score) {
            best_out = out;
            best_score = new_score;
        }

        end = std::chrono::system_clock::now();
    }
    
    return best_out;
}

void test_score() {
    vector<int> t(D);
    REP(i, D) cin >> t[i];
    compute_score(t);
}

int main(int argc, char const *argv[])
{
    int d_;
    cin >> d_;
    D = d_;
    
    REP(i, T) cin >> c[i];
    REP(i, D) REP(j, T) cin >> s[i][j];

    
    vector<int> out = solve();
    assert(out.size() == D);
    for (int t : out) {
        cout << t << endl;
    }

    return 0;
}


Measured memory_bytes: 4268