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

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

void output(const array<int, D>& sch){
    for(auto x : sch){
        cout << x + 1 << endl;
    }
}

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(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(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(const array<int, D>& ans, int i, int t2){
    const int t1 = ans.at(i);
    if(t1 == t2){ return 0; }
    int ret = 0;
    ret += s.at(i).at(t2) - s.at(i).at(t1);

    // prev
    int pen_prev = 0;
    {
        int pen_t1 = 0, pen_t2 = 0, last_t1 = 0, last_t2 = 0;
        REP(j, D){
            if(ans.at(j) == t1){
                last_t1 = j + 1;
            }else if(ans.at(j) == t2){
                last_t2 = j + 1;
            }
            pen_t1 += c.at(t1) * (j + 1 - last_t1);
            pen_t2 += c.at(t2) * (j + 1 - last_t2);
        }
        pen_prev = pen_t1 + pen_t2;
    }

    // new
    int pen_new;
    {
        int pen_t1_2 = 0, pen_t2_2 = 0, last_t1_2 = 0, last_t2_2 = 0;
        REP(j, D){
            if(i != j){
                if(ans.at(j) == t1){
                    last_t1_2 = j + 1;
                }else if(ans.at(j) == t2){
                    last_t2_2 = j + 1;
                }
            }else{
                last_t2_2 = j + 1;
            }
            pen_t1_2 += c.at(t1) * (j + 1 - last_t1_2);
            pen_t2_2 += c.at(t2) * (j + 1 - last_t2_2);
        }
        pen_new = pen_t1_2  + pen_t2_2;
    }

    ret += - pen_new + pen_prev;

    return ret;
}

void greedy_update(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(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(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);
    array<int, D> ans;
    greedy_init(ans);
    greedy_update(ans);
    if(get_cur_sec() >= 1.9){
        output(ans);
        return;
    }

    uniform_real_distribution<> ur(0.0, 1.0);
    int cur_score = calc_satisfaction(ans);
    int best_score = cur_score;
    auto best_ans = 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){
                const int cur_k = ans.at(j);
                if(k == cur_k){ continue; }
                const int tmp = calc_score_delta(ans, j, k);
                if(exp((double)tmp / temp) >= ur(rng)){
                    ans.at(j) = k;
                    cur_score += tmp;
                    modified = true;
                    if(cur_score > best_score){
                        best_score = cur_score;
                        best_ans = ans;
                    }
                }
            }
        }
        if(get_cur_sec() >= 1.9){
            break;
        }
        if(modified){
            temp *= 0.9;
        }else{
            temp /= 0.9;
        }
    }
    output(best_ans);
}

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


Measured memory_bytes: 4272