#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}

unsigned int randxor()
{
    static unsigned int x=123456789,y=362436069,z=521288629,w=88675123;
    unsigned int t;
    t=(x^(x<<11));x=y;y=z;z=w; return( w=(w^(w>>19))^(t^(t>>8)) );
}

constexpr int n = 26;
constexpr int d = 365;
constexpr double ep = 1.9;
std::vector<long long> c;
std::vector<std::vector<long long>> s;
vector<set<int>> day;
vector<int> ret;


i64 calc(vector<int> v){
    i64 ans = 0;
    vector<int> last(n, 0);
    for(int i = 1; i <= d; ++i){
        ans += s[i - 1][v[i - 1]];
        last[v[i - 1]] = i;
        for(int j = 0; j < n; ++j)
            ans -= c[j] * (i - last[j]);
    }
    return ans;
}

int update(int k, int q, bool force = false){
    if(ret[k] == q)
        return 0;
    auto aft = day[ret[k]].upper_bound(k);
    auto bef = prev(day[ret[k]].lower_bound(k));
    auto aft2 = day[q].upper_bound(k);
    auto bef2 = prev(day[q].lower_bound(k));
    int lb = k - *bef;
    int rb = *aft - k;
    int mb = lb + rb;
    int lb2 = k - *bef2;
    int rb2 = *aft2 - k;
    int mb2 = lb2 + rb2;

    int score = 0;

    int m1 = c[ret[k]] * mb * (mb - 1) / 2;
    int l1 = c[ret[k]] * lb * (lb - 1) / 2;
    int r1 = c[ret[k]] * rb * (rb - 1) / 2;

    int m2 = c[q] * mb2 * (mb2 - 1) / 2;
    int l2 = c[q] * lb2 * (lb2 - 1) / 2;
    int r2 = c[q] * rb2 * (rb2 - 1) / 2;

    score -= m1;
    score += l1;
    score += r1;

    score += m2;
    score -= l2;
    score -= r2;

    score -= s[k][ret[k]];
    score += s[k][q];

    if(score >= 0 || force){
        day[ret[k]].erase(k);
        day[q].emplace(k);
        ret[k] = q;
    }
    return score;
}

int best_score;
vector<int> ans;

bool fn(int score, int next_score, double per){
    static constexpr int s_temp = 2000;
    static constexpr int e_temp = 500;
    double temp = s_temp + (e_temp - s_temp) * per;
    double p = next_score >= score ? 1.0 : exp((next_score - score) / temp);
    double rnd = (1.0 * randxor() / UINT_MAX);
    if(best_score < next_score){
        best_score = next_score;
        ans = ret;
    }
    return p > rnd;
}

void solve(){
    ret.resize(d);
    day.resize(n);
    for(int i = 0; i < n; ++i){
        day[i].emplace(-1);
        day[i].emplace(d);
    }
    vector<int> bef(n, -1);
    for(int i = 0; i < d; ++i){
        int id = (i + 10) % 26;
        ret[i] = id;
        day[ret[i]].emplace(i);
    }

    int score = calc(ret);
    ans = ret;
    best_score = score;
    clock_t st = clock();
    double cl = 0;
    while(cl < 1){
        cl = (double(clock() - st) / CLOCKS_PER_SEC) / ep;
        for(int _ = 0; _ < 10000; ++_){
            if(randxor() % 4){
                int diff = randxor() % 8 + 1;
                int d1 = randxor() % (d - diff);
                int d2 = d1 + diff;
                int p1 = ret[d1];
                int p2 = ret[d2];
                int next_score = score;
                next_score += update(d1, p2, true);
                next_score += update(d2, p1, true);
                if(fn(score, next_score, cl)){
                    score = next_score;
                }else{
                    update(d1, p1, true);
                    update(d2, p2, true);
                }
            }else{
                int d1 = randxor() % d;
                int k1 = randxor() % n;
                int b1 = ret[d1];
                int next_score = score + update(d1, k1, true);
                if(fn(score, next_score, cl)){
                    score = next_score;
                }else{
                    update(d1, b1, true);
                }
            }
        }
    }
    for(int i = 0; i < d; ++i)
        printf("%d\n", ans[i] + 1);
}


signed main(){
    int d_;
    scanf("%d", &d_);
    c.resize(26);
    for(int i = 0 ; i < 26 ; i++)
        scanf("%lld",&c[i]);
    s.assign(d, std::vector<long long>(26));
    for(int i = 0 ; i < d; i++){
        for(int j = 0 ; j < 26 ; j++){
            scanf("%lld",&s[i][j]);
        }
    }
    solve();
    return 0;
}



Measured memory_bytes: 4460