#include <bits/stdc++.h>
using namespace std;

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T>
string join(const vector<T>&v, string del=", "){ stringstream s;
    for(auto x : v) s << del << x; return s.str().substr(del.size());
}
template<typename T>
ostream& operator<<(ostream& o, const vector<T>&v){
    if(v.size()) o << "[" << join(v) << "]"; return o;
}
template<typename T>
ostream& operator<<(ostream& o, const vector<vector<T> >&vv){
    int l = vv.size();
    if(l){ o<<endl; rep(i,l) o << (i==0 ? "[ " : ",\n  " ) << vv[i] << (i==l-1 ? " ]" : ""); }
    return o;
}
template<typename T>
ostream& operator<<(ostream& o, const set<T>& st){
    vector<T> v(st.begin(),st.end());
    o<<"{ "<<join(v)<<" }";
    return o;
}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

int N;
int D;
vi c;
vvi s;
chrono::system_clock::time_point start;
ll calc_score(vi t){
    ll res = 0;
    vi last(N, -1);
    rep(i,D){
        res += s[i][t[i]];
        last[t[i]] = i;
        rep(j,N){
            res -= c[j] * (i - last[j]);
        }
    }
    return res;
}

vi greedy(){
    vi t(D);
    vi last(N, -1);
    rep(i,D){
        int idx = 0;
        int score = 0;
        rep(j,N){
            int jscore = s[i][j] + (c[j] * (i - last[j]));
            if(score < jscore){
                score = jscore;
                idx = j;
            }
        }
        t[i] = idx;
        last[idx] = i;
    }
    return t;
}


vi search(){
    vi t = greedy();
    vector<multiset<int>> last(N);
    rep(i,N) last[i].insert(-1);
    rep(i,D) last[t[i]].insert(i);
    rep(i,N) last[i].insert(D);
    int loopcnt = 0;
    while(1){
        if(loopcnt % 100 == 0){
            auto now = chrono::system_clock::now();
            double elapsed = chrono::duration_cast<chrono::milliseconds>(now-start).count();
            if(elapsed > 1900) break;
        }
        random_device rnd;
        int day = rnd() % D;
        int cur = rnd() % N;
        int pre = t[day];
        if(cur == pre) continue;

        int pday0 = *--last[pre].lower_bound(day);
        int pday1 = *++last[pre].lower_bound(day);
        int cday0 = *--last[cur].lower_bound(day);
        int cday1 = *last[cur].lower_bound(day);
        int diff = s[day][cur] - s[day][pre];
        diff += (day - cday0) * c[cur] * (cday1 - day);
        diff -= (day - pday0) * c[pre] * (pday1 - day);
        if(diff > 0){
            t[day] = cur;
            last[cur].insert(day);
            last[pre].erase(day);
        }
        loopcnt++;
    }
    return t;
}

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./tester/data/test1.in");
    start = chrono::system_clock::now();
    N = 26;
    cin >> D;
    c = vi(N);
    s = vvi(D, vi(N));
    rep(i,N) cin >> c[i];
    rep(i,D) rep(j,N) cin >> s[i][j];

    vi t = search();
    debug(calc_score(t));
    for(auto ti : t){
        cout << ti+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3704