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

mt19937 rng;
clock_t start;

const int D = 365;
const int NTYPE = 26;
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_satisfaction(const array<int, D>& sch){
    int ret = 0;
    array<int, NTYPE> last;
    fill(ALL(last), 0);
    REP(i, D){
        const int cur_d = i + 1;
        const int t = sch.at(i);
        ret += s.at(i).at(t);
        last.at(t) = cur_d;
        REP(j, NTYPE){
            ret -= c.at(j) * (cur_d - last.at(j));
        }
    }
    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(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;
        REP(j, D){
            int best_k = ans.at(j);
            int best_delta = 0;
            REP(k, NTYPE){
                if(ans.at(j) == k){ continue; }
                const int tmp = calc_score_delta(ans, j, k);
                if(tmp > best_delta){
                    best_k = k;
                    best_delta = tmp;
                }
            }
            if(best_k != ans.at(j)){
                modified = true;
            }
            ans.at(j) = best_k;
            cur_score += best_delta;
            // assert(cur_score == calc_satisfaction(ans));
        }
        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;
                    }
                    break;
                }
            }
        }
        if(!modified || get_cur_sec() >= 1.9){
            break;
        }
        temp *= 0.9;
    }
    output(best_ans);
}

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


Measured memory_bytes: 4324