#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll 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){
    array<int, NTYPE> last;
    fill(ALL(last), 0);
    REP(i, D){
        const int cur_d = i + 1;
        int max_type = -1;
        int max_val = numeric_limits<int>::min();
        REP(j, NTYPE){
            int tmp = s.at(i).at(j) + c.at(j) * (cur_d - last.at(j));
            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 greedy_init_org(array<int, D>& ans){
    array<int, NTYPE> last;
    fill(ALL(last), 0);
    REP(i, D){
        const int cur_d = i + 1;
        int max_type = -1;
        int max_val = numeric_limits<int>::min();
        REP(j, NTYPE){
            int tmp = s.at(i).at(j) + c.at(j) * (cur_d - last.at(j));
            if(max_val < tmp){
                max_type = j;
                max_val = tmp;
            }
        }
        assert(max_type != -1);
        ans.at(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_swap_org(array<int, D>& ans, int i, int j){
    if(ans.at(i) == ans.at(j)){ return 0; }
    const int ti = ans.at(i);
    const int tj = ans.at(j);
    const int prev_score = calc_score_type(ans, ti) + calc_score_type(ans, tj);
    swap(ans.at(i), ans.at(j));
    const int new_score = calc_score_type(ans, ti) + calc_score_type(ans, tj);
    swap(ans.at(i), ans.at(j));
    return new_score - prev_score;
}

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

int calc_score_delta_set_org(array<int, D>& ans, int i, int t2){
    const int t1 = ans.at(i);
    if(t1 == t2){ return 0; }
    const int prev_score = calc_score_type(ans, t1) + calc_score_type(ans, t2);
    ans.at(i) = t2;
    const int new_score = calc_score_type(ans, t1) + calc_score_type(ans, t2);
    ans.at(i) = t1;
    return new_score - prev_score;
}

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);
                    // swap(ans.at(j), ans.at(j + delta));
                    // assert(calc_satisfaction(ans) == cur_score);
                }
            }
        }

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

void greedy_update_org(array<int, D>& ans){
    int cur_score = calc_satisfaction(ans);
    bool modified = true;
    while(modified){
        modified = false;
        // change type
        REP(j, D){
            REP(k, NTYPE){
                if(ans.at(j) == k){ continue; }
                const int tmp = calc_score_delta_set_org(ans, j, k);
                if(tmp > 0){
                    modified = true;
                    ans.at(j) = k;
                    cur_score += tmp;
                }
            }
        }

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

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

void solve(){
    rng.seed(0);
    Schedule ans;
    // array<int, D> ans_org;
    greedy_init(ans);
    // greedy_init_org(ans_org);
    // assert(ans.score == calc_satisfaction(ans_org));
    greedy_update(ans);
    // greedy_update_org(ans_org);
    // assert(ans.score == calc_satisfaction(ans_org));
    if(get_cur_sec() >= 1.9){
        ans.output();
        return;
    }

    uniform_real_distribution<> ur(0.0, 1.0);
    auto best = ans;
    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);
                // const int tmp2 = calc_score_delta_set_org(ans_org, j, k);
                // assert(tmp == tmp2);
                if(exp((double)tmp / temp) >= ur(rng)){
                    ans.set(j, k);
                    // ans_org.at(j) = k;
                    modified = true;
                    if(ans.score > best.score){
                        best = ans;
                    }
                }
            }

            for(int delta = 1; delta <= MAX_DELTA_DAY && j + delta < D; ++delta){
                const int tmp = calc_score_delta_swap(ans, j, j + delta);
                // const int tmp2 = calc_score_delta_swap_org(ans_org, j, j + delta);
                // assert(tmp == tmp2);
                if(exp((double)tmp / temp) >= ur(rng)){
                    modified = true;
                    ans.swap(j, j + delta);
                    // swap(ans_org.at(j), ans_org.at(j + delta));
                    if(ans.score > best.score){
                        best = ans;
                    }
                }
            }
        }

        if(get_cur_sec() >= 1.9){
            break;
        }
        if(modified){
            temp *= 0.9;
        }else{
            temp /= 0.9;
        }
    }
    best.output();
}

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


Measured memory_bytes: 4384