#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 int border = 16000;
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;
    }

    return 0;
}


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

    vector<pair<int,int>> cand;
    for(int i = 0; i < d; ++i)
        for(int j = 0; j < n; ++j)
            if(s[i][j] >= border)
                cand.emplace_back(i, j);

    int score = calc(ret);
    clock_t st = clock();
    while(double(clock() - st) / CLOCKS_PER_SEC <= 1.9){

        if(randxor() % 8){
            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(next_score < score){
                next_score += update(d1, p1, true);
                next_score += update(d2, p2, true);
            }
        }
        else{
            auto p = cand[randxor() % cand.size()];
            // score += update(randxor() % d, randxor() % 26);
            score += update(p.first, p.second);
        }
    }
    for(int i = 0; i < d; ++i)
        printf("%d\n", ret[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: 4012