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


// (得点差, 始点の日付, 番号)
// set<tuple<int,int,int>> sc;


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){
    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){
        /*
        sc.erase({m1, *bef, ret[k]});
        sc.emplace(l1, *bef, ret[k]);
        sc.emplace(r1, k, ret[k]);
        sc.emplace(m2, *bef, q);
        sc.erase({l1, *bef, q});
        sc.erase({r1, k, q});
        */

        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 % 26;
        ret[i] = id;
        // sc.emplace(, bef[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.8){

        int pd = randxor() % cand.size();
        auto p = cand[pd];
        // cout << (ret[p.first] == p.second) << endl;
        if(ret[p.first] == p.second)
            score += update(p.first, randxor() % 26);
        else
            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: 3960