#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);
            // for(int i2 = i; i2 < min(D, i + k + 1); ++i2){
            //     tmp += c.at(j) * (i2 + 1 - last.at(j));
            //     tmp -= c.at(j) * (i2 + 1 - (i + 1));
            // }

            // int tmp = s.at(i).at(j) + c.at(j) * (i + 1 - last.at(j));
            // int tmp = s.at(i).at(j);
            // REP(j2, NTYPE){
            //     const int cj2 = c.at(j2);
            //     int last_day;
            //     if(j != j2){
            //         last_day = last.at(j2);
            //     }else{
            //         last_day = i + 1;
            //     }
            //     int tmp2 = 0;
            //     for(int i2 = i; i2 < min(D, i + k + 1); ++i2){
            //         tmp2 += i2 + 1 - last_day;
            //     }
            //     tmp -= cj2 * tmp2;
            // }
            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 solve(){
    rng.seed(0);
    Schedule ans;
    greedy_init(ans, 2);
    // int best_k = 0;
    // REP(k, 20){
    //     Schedule ans2;
    //     greedy_init(ans2, k);
    //     if(ans2.score > ans.score){
    //         ans = ans2;
    //         best_k = k;
    //     }
    // }
    // cerr << "best_k=" << best_k << endl;
    // ans.output();
    // return;
    greedy_update(ans);
    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);
                if(exp((double)tmp / temp) >= ur(rng)){
                    ans.set(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);
                if(exp((double)tmp / temp) >= ur(rng)){
                    modified = true;
                    ans.swap(j, 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: 4412