#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;

const int D = 365;
const int NTYPE = 26;
const int MAX_DELTA_DAY = 10;

minstd_rand rng;
clock_t start;

array<int, NTYPE> c;
array<array<int, NTYPE>, D> s;

array<int, D> day_order;
array<int, NTYPE> type_order;

struct TypeSchedule {
    int id;
    set<int> day;
    int score;

    int get_prev_day(int x) const {
        assert(day.count(x) == 0);
        auto it1 = day.lower_bound(x);
        int prev_day = -1;
        if(it1 != day.begin()){
            prev_day = *(--it1);
        }
        return prev_day;
    }

    int get_next_day(int x) const {
        assert(day.count(x) == 0);
        const auto it2 = day.upper_bound(x);
        int next_day = D;
        if(it2 != day.end()){
            next_day = *it2;
        }
        return next_day;
    }

    TypeSchedule(int id) : id(id) {
        score = - c.at(id) * (D + 1) * D / 2;
    }
    void add(int x){
        const int prev_day = get_prev_day(x);
        const int next_day = get_next_day(x);
        // prev_day + 1, ... , next_day - 1 = next_day - prev_day - 1 個
        const int l = next_day - prev_day - 1;
        int diff = c.at(id) * (l + 1) * l / 2;
        // prev_day + 1, ..., x - 1 = x - prev_day - 1 個
        const int m1 = x - prev_day - 1;
        const int m2 = next_day - x - 1;
        diff -= c.at(id) * (m1 * (m1 + 1) / 2 + m2 * (m2 + 1) / 2);
        diff += s.at(x).at(id);
        score += diff;
        day.insert(x);
    }
    void remove(int x){
        assert(day.count(x) == 1);
        day.erase(x);
        const int prev_day = get_prev_day(x);
        const int next_day = get_next_day(x);
        // prev_day + 1, ... , next_day - 1 = next_day - prev_day - 1 個
        const int l = next_day - prev_day - 1;
        int diff = - c.at(id) * (l + 1) * l / 2;
        // prev_day + 1, ..., x - 1 = x - prev_day - 1 個
        const int m1 = x - prev_day - 1;
        const int m2 = next_day - x - 1;
        diff += c.at(id) * (m1 * (m1 + 1) / 2 + m2 * (m2 + 1) / 2);
        diff -= s.at(x).at(id);
        score += diff;
    }
};

struct Schedule{
    vector<TypeSchedule> type;
    array<int, D> d2t;
    int score;
    Schedule(){
        fill(ALL(d2t), -1);
        score = 0;
        REP(i, NTYPE){
            type.emplace_back(i);
            score += type.at(i).score;
        }
        validate_score();
    }
    void set(int d, int t){
        if(d2t.at(d) == t){ return; }
        const int prev_t = d2t.at(d);
        score -= type.at(t).score;
        d2t.at(d) = t;
        type.at(t).add(d);
        score += type.at(t).score;
        if(prev_t != -1){
            score -= type.at(prev_t).score;
            type.at(prev_t).remove(d);
            score += type.at(prev_t).score;
        }
        validate_score();
    }
    int get(int d) const { return d2t.at(d); }
    void unset(int d, int t){
        score -= type.at(t).score;
        d2t.at(d) = -1;
        type.at(t).remove(d);
        score += type.at(t).score;
        validate_score();
    }
    void swap(int d1, int d2){
        if(get(d1) == get(d2)){ return; }
        const int t1 = get(d1);
        const int t2 = get(d2);
        set(d1, t2);
        set(d2, t1);
        validate_score();
    }

    void output() const {
        REP(i, D){
            assert(d2t.at(i) != -1);
            cout << d2t.at(i) + 1 << endl;
        }
    }

    void validate_score() const {
        return;
        // int tmp = 0;
        // array<int, NTYPE> last;
        // fill(ALL(last), 0);
        // REP(i, D){
        //     int t = get(i);
        //     if(t != -1){
        //         tmp += s.at(i).at(t);
        //         last.at(t) = i + 1;
        //     }
        //     REP(s, NTYPE){
        //         tmp -= c.at(s) * (i + 1 - last.at(s));
        //     }
        // }
        // assert(tmp == score);
    }
};

void input(){
    int _d;
    cin >> _d;
    REP(i, NTYPE){
        cin >> c.at(i);
    }
    REP(i, D){
        REP(j, NTYPE){
            cin >> s.at(i).at(j);
        }
    }
}

int calc_score_type(const array<int, D>& sch, int t){
    int last = 0;
    int ret = 0;
    REP(i, D){
        if(sch.at(i) == t){
            ret += s.at(i).at(t);
            last = i + 1;
        }
        ret -= c.at(t) * (i + 1 - last);
    }
    return ret;
}

int calc_satisfaction(const array<int, D>& sch){
    int ret = 0;
    REP(i, NTYPE){
        ret += calc_score_type(sch, i);
    }
    return ret;
}

void greedy_init(Schedule& ans, int k = 1){
    array<int, NTYPE> last;
    fill(ALL(last), 0);
    REP(i, D){
        int max_type = -1;
        int max_val = numeric_limits<int>::min();
        REP(j, NTYPE){
            int tmp = s.at(i).at(j);
            tmp += c.at(j) * (i + 1 - last.at(j)) * (min(D, i + k + 1) - i);
            if(max_val < tmp){
                max_type = j;
                max_val = tmp;
            }
        }
        assert(max_type != -1);
        ans.set(i, max_type);
        last.at(max_type) = i + 1;
    }
}

void init(){
    REP(i, D){
        day_order.at(i) = i;
    }
    REP(i, NTYPE){
        type_order.at(i) = i;
    }
}

double get_cur_sec(){
    return (double)(clock() - start) / CLOCKS_PER_SEC;
}

int calc_score_delta_swap(Schedule& ans, int i, int j){
    if(ans.get(i) == ans.get(j)){ return 0; }
    const int ti = ans.get(i);
    const int tj = ans.get(j);
    assert(ti != -1 && tj != -1);
    int diff = - ans.score;
    ans.set(i, tj);
    ans.set(j, ti);
    diff += ans.score;
    ans.set(i, ti);
    ans.set(j, tj);
    return diff;
}

int calc_score_delta_set(Schedule& ans, int i, int t2){
    const int t1 = ans.get(i);
    assert(t1 != -1);
    if(t1 == t2){ return 0; }
    int diff = - ans.score;
    ans.set(i, t2);
    diff += ans.score;
    ans.set(i, t1);
    return diff;
}

void greedy_update(Schedule& ans){
    bool modified = true;
    while(modified){
        modified = false;
        // change type
        REP(j, D){
            REP(k, NTYPE){
                if(ans.get(j) == k){ continue; }
                const int tmp = calc_score_delta_set(ans, j, k);
                if(tmp > 0){
                    modified = true;
                    ans.set(j, k);
                }
            }
        }

        // swap day
        REP(j, D){
            for(int delta = 1; delta <= MAX_DELTA_DAY && j + delta < D; ++delta){
                const int tmp = calc_score_delta_swap(ans, j, j + delta);
                if(tmp > 0){
                    modified = true;
                    ans.swap(j, j + delta);
                }
            }
        }

        if(get_cur_sec() >= 1.9){ break; }
    }
}

void search_cycle(Schedule& out, double exit_time, int max_it){
    for(int it = 0; it < max_it; ++it){
        REP(j, D){
            Schedule s = out;
            array<bool, D> moved;
            fill(ALL(moved), false);
            int cur = j;
            moved.at(cur) = true;
            while(1){
                int max_j2 = -1;
                int max_diff = numeric_limits<int>::min();
                for(int j2 = max(0, cur - 10); j2 < min(D, cur + 10); ++j2){
                    if(moved.at(j2) || s.get(j2) == s.get(cur)){ continue; }
                    int tmp = calc_score_delta_swap(s, j, j2);
                    if(max_diff < tmp){
                        max_j2 = j2;
                        max_diff = tmp;
                    }
                }
                if(max_j2 == -1){ break; }
                cur = max_j2;
                s.swap(j, cur);
                moved.at(cur) = true;
                if(s.score > out.score){
                    out = s;
                }
                if(get_cur_sec() >= exit_time){
                    cerr << it << endl;
                    return;
                }
            }
        }
    }
}

void search_tabu(Schedule& out){
    Schedule ans = out;
    array<array<int, NTYPE>, D> tabu;
    REP(i, D){ fill(ALL(tabu.at(i)), numeric_limits<int>::min()); }
    int tabu_len = 100;
    for(int it = 0; ; ++it){
        shuffle(ALL(day_order), rng);
        shuffle(ALL(type_order), rng);
        int max_j = -1, max_k = -1, max_diff = numeric_limits<int>::min();
        bool break_flg = false;
        for(int j : day_order){
            for(int k : type_order){
                if(ans.get(j) == k){ continue; }
                const int tmp = calc_score_delta_set(ans, j, k);
                if(ans.score + tmp > out.score){
                    max_j = j;
                    max_k = k;
                    max_diff = tmp;
                    break_flg = true;
                    break;
                }else if(tabu.at(j).at(k) + tabu_len <= it && tmp > max_diff){
                    max_j = j;
                    max_k = k;
                    max_diff = tmp;
                }
            }
            if(break_flg){ break; }
        }
        assert(max_j != -1 && max_k != -1);
        ans.set(max_j, max_k);
        tabu.at(max_j).at(max_k) = it;
        if(out.score < ans.score){
            out = ans;
        }
        if(get_cur_sec() >= 1.9){
            break;
        }
    }
}

void search_sa(Schedule& out, double exit_time){
    Schedule ans = out;
    uniform_real_distribution<> ur(0.0, 1.0);
    double temp = 2000;
    while(true){
        bool modified = false;
        shuffle(ALL(day_order), rng);
        shuffle(ALL(type_order), rng);
        for(int j : day_order){
            for(int k : type_order){
                if(k == ans.get(j)){ continue; }
                const int tmp = calc_score_delta_set(ans, j, k);
                if(exp((double)tmp / temp) >= ur(rng)){
                    ans.set(j, k);
                    modified = true;
                    if(ans.score > out.score){
                        out = ans;
                    }
                }
            }

            // for(int delta = 1; delta <= MAX_DELTA_DAY && j + delta < D; ++delta){
            //     const int tmp = calc_score_delta_swap(ans, j, j + delta);
            //     if(exp((double)tmp / temp) >= ur(rng)){
            //         modified = true;
            //         ans.swap(j, j + delta);
            //         if(ans.score > out.score){
            //             out = ans;
            //         }
            //     }
            // }
        }
        search_cycle(ans, 1.9, 1);
        if(ans.score > out.score){
            out = ans;
            modified = true;
        }

        if(get_cur_sec() >= exit_time){
            break;
        }
        if(modified){
            temp *= 0.9;
        }else{
            // break;
            temp /= 0.9;
        }
    }
}

void solve(){
    rng.seed(0);
    Schedule ans;
    greedy_init(ans, 1);
    greedy_update(ans);
    if(get_cur_sec() >= 1.9){
        ans.output();
        return;
    }
    // search_sa(ans, 1.0);
    search_sa(ans, 1.9);
    // search_tabu(ans);
    // search_cycle(ans, 1.9);
    ans.output();
}

int main(){
    start = clock();
    input();
    init();
    solve();
    return 0;
}


Measured memory_bytes: 4424