#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <cstdlib>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <limits>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <time.h>
#include <sys/timeb.h>
using namespace std;

template<class F, class S> string in_v_to_str (const pair<F, S> v);
template<class F, class S> string v_to_str (const pair<F, S> v);
string in_v_to_str (const char v) { return "'" + string{v} + "'"; }
string in_v_to_str (const char* v) { return "\"" + string(v) + "\""; }
string in_v_to_str (const string v) { return "\"" + v + "\""; }
template<class T> string in_v_to_str (const T v) { stringstream ss; ss << v; return ss.str(); }
template<class T> string v_to_str (const T v) { stringstream ss; ss << v; return ss.str(); }
template<class T, size_t N> string v_to_str (const array<T, N>& v) { stringstream ss; if (v.size() > 0) { ss << "["; for (int i = 0; i < v.size() - 1; ++i) { ss << in_v_to_str(v[i]) << ", "; } ss << in_v_to_str(v[v.size() - 1]) << "]"; } else { ss << "[]"; } return ss.str(); }
template<class T, size_t N> string v_to_str (const array< array<T, N>, N >& v) { stringstream ss; if (v.size() > 0) { ss << "["; for (int i = 0; i < v.size() - 1; ++i) { ss << v_to_str(v[i]) << ", "; } ss << v_to_str(v[v.size() - 1]) << "]"; } else { ss << "[-]"; } return ss.str(); }
template<class T> string v_to_str (const vector<T>& v) { stringstream ss; if (v.size() > 0) { ss << "["; for (int i = 0; i < v.size() - 1; ++i) { ss << in_v_to_str(v[i]) << ", "; } ss << in_v_to_str(v[v.size() - 1]) << "]"; } else { ss << "[]"; } return ss.str(); }
template<class T> string v_to_str (const vector< vector<T> >& v) { stringstream ss; if (v.size() > 0) { ss << "["; for (int i = 0; i < v.size() - 1; ++i) { ss << v_to_str(v[i]) << ", "; } ss << v_to_str(v[v.size() - 1]) << "]"; } else { ss << "[-]"; } return ss.str(); }
template<class T> string v_to_str (const set<T>& v) { stringstream ss; int len = v.size(); ss << (v.size() > 0 ? "{" : "{}"); for (auto& i : v) { ss << in_v_to_str(i) << (len-- > 1 ? ", " : "}"); } return ss.str(); }
template<class K, class V> string v_to_str (const map<K, V>& v) { stringstream ss; int len = v.size(); ss << (v.size() > 0 ? "{" : "{}"); for (auto& i : v) { ss << in_v_to_str(i.first) << " : " << in_v_to_str(i.second) << (len-- > 1 ? ", " : "}"); } return ss.str(); }
template<class T> string v_to_str (const unordered_set<T>& v) { stringstream ss; int len = v.size(); ss << (v.size() > 0 ? "{" : "{}"); for (auto& i : v) { ss << in_v_to_str(i) << (len-- > 1 ? ", " : "}"); } return ss.str(); }
template<class K, class V> string v_to_str (const unordered_map<K, V>& v) { stringstream ss; int len = v.size(); ss << (v.size() > 0 ? "{" : "{}"); for (auto& i : v) { ss << in_v_to_str(i.first) << " : " << in_v_to_str(i.second) << (len-- > 1 ? ", " : "}"); } return ss.str(); }
template<class F, class S> string in_v_to_str (const pair<F, S> v) { stringstream ss; ss << "<" << v_to_str(v.first) << ", " << v_to_str(v.second) << ">"; return ss.str(); }
template<class F, class S> string v_to_str (const pair<F, S> v) { stringstream ss; ss << "<" << v_to_str(v.first) << ", " << v_to_str(v.second) << ">"; return ss.str(); }
string print () { return ""; }
template<typename F, typename... R> string print (const F& f, const R& ...r) { stringstream ss; ss << v_to_str(f); if (sizeof...(r) > 0) { ss << " " << print(r...); } return ss.str(); }

template<typename F, typename... R> void pdebug (const F& f, const R& ...r) {
    stringstream ss;
    ss << v_to_str(f); if (sizeof...(r) > 0) { ss << " " << print(r...); }
    cerr << "<cerr>" << ss.str() << "</cerr>" << endl;
}

template<typename F, typename... R> void fdebug (const F& f, const R& ...r) {
    stringstream ss;
    ss << v_to_str(f); if (sizeof...(r) > 0) { ss << " " << print(r...); }
    cerr << "<cerrfile>" << ss.str() << "</cerrfile>" << endl;
}

struct e512pos {
public:
    int x;
    int y;
    e512pos () { this->x = 0; this->y = 0; }
    e512pos (int x, int y) {
        this->x = x;
        this->y = y;
    }
    e512pos operator + (const e512pos& t) { return e512pos(this->x + t.x, this->y + t.y); }
    e512pos operator - (const e512pos& t) { return e512pos(this->x - t.x, this->y - t.y); }
    bool operator == (const e512pos& t) const { return this->x == t.x && this->y == t.y; }
};
namespace std {
    template <> class hash<e512pos> {
    public:
        size_t operator()(const e512pos& t) const{ return hash<int>()(t.x<<16) | hash<int>()(t.y); }
    };
}
ostream& operator << (ostream& os, const e512pos& p) {
    os << "(" << p.x << ", " << p.y << ")";
    return os;
};

class StopWatch {
public:
    int starts;
    int startm;
    int tstarts = 0;
    int tstartm = 0;
    struct timeb timebuffer;
    StopWatch () {
        ftime(&this->timebuffer);
        this->starts = this->timebuffer.time;
        this->startm = this->timebuffer.millitm;
    }
    inline void stop () {
        ftime(&this->timebuffer);
        this->tstarts = this->timebuffer.time;
        this->tstartm = this->timebuffer.millitm;
    }
    inline void resume () {
        ftime(&this->timebuffer);
        this->starts += this->timebuffer.time - this->tstarts;
        this->startm += this->timebuffer.millitm - this->tstartm;
    }
    inline int get_milli_time () {
        ftime(&this->timebuffer);
        return (this->timebuffer.time - this->starts) * 1000 + (this->timebuffer.millitm - this->startm);
    }
};

inline uint32_t xrnd() {
    static uint32_t y = 2463534242;
    y = y ^ (y << 13);
    y = y ^ (y >> 17);
    return y = y ^ (y << 5);
}


class MM {
public:
    StopWatch sw;
    
    int D;
    int C[26];
    int CC[366][26];
    int S[365][26];
    
    vector< vector< pair<int, int> > > XX;
    MM () {
        this->sw = StopWatch();
        this->input();
        
        
        for (int y = 0; y < 365; ++y) {
            vector< pair<int, int> > v;
            for (int x = 0; x < 26; ++x) {
                v.emplace_back(x, this->S[y][x] + this->C[x] * 4);
            }
            sort(v.begin(), v.end(), [](const pair<int, int>& a, const pair<int, int>& b) { return a.second > b.second; });
            XX.emplace_back(v);
        }
        
        
        
        vector<int> ret;
        for (int i = 0; i < this->D; ++i) {
            int best = 0;
            int bestscore = 0;
            for (int x = 0; x < 26; ++x) {
                if (this->S[i][x] + this->C[x]*8 > bestscore) {
                    best = x;
                    bestscore = this->S[i][x] + this->C[x]*8;
                }
            }
            
            ret.emplace_back(best);
        }
        
        ret = this->SA(1800, ret);
        
        int score = this->allScore(ret);
        
        pdebug(score);
        
        
        this->output(ret);
    }
    
    void input () {
        cin >> this->D;
        for (int i = 0; i < 26; ++i) {
            cin >> this->C[i];
        }
        for (int z = 0; z < 366; ++z) {
            for (int i = 0; i < 26; ++i) {
                this->CC[z][i] = 0;
                
                for (int y = 0; y < z; ++y) {
                    this->CC[z][i] += this->C[i] * y;
                }
            }
            
        }
        
        
        
        for (int y = 0; y < 365; ++y) {
            for (int x = 0; x < 26; ++x) {
                this->S[y][x] = 0;
            }
        }
        
        for (int y = 0; y < this->D; ++y) {
            for (int x = 0; x < 26; ++x) {
                cin >> this->S[y][x];
            }
        }
        
    }
    void output (vector<int> ret) {
        for (auto&& i : ret) {
            cout << i+1 << endl;
        }
    }
    
    int allScore (vector<int> ret) {
        int score = 1000000;
        int last[26];
        for (int i = 0; i < 26; ++i) {
            last[i] = -1;
        }
        for (int y = 0; y < this->D; ++y) {
            score += this->S[y][ret[y]];
            score -= this->CC[y - last[ret[y]]][ret[y]];
            last[ret[y]] = y;
        }
        
        for (int x = 0; x < 26; ++x) {
            if (last[x] == -1) {
                score -= this->CC[this->D][x];
            } else {
                score -= this->CC[this->D - last[x]][x];
            }
        }
        
        return score;
    }
    
    
    vector<int> SA (int limit, vector<int> ret) {
        StopWatch sw;
        
        vector<int> bestret = ret;
        double bestscore = this->allScore(ret);
        double lastscore = bestscore;
        int saTimeStart = sw.get_milli_time();
        int saTimeEnd   = limit;
        int saTimeCurrent = saTimeStart;
        int64_t R = 1000000000;
        int cnt = 0;
        while ((saTimeCurrent = sw.get_milli_time()) < saTimeEnd) {
            for (int z = 0; z < this->D; ++z) {
                int a = xrnd() % 4;
                
                int tmp = ret[z];
                ret[z] = this->XX[z][a].first;
                
                double tmpscore = this->allScore(ret);
                
                const double T = saTimeEnd-saTimeStart;
                const double t = saTimeCurrent-saTimeStart;
                const double startTemp   = 8.0;
                const double endTemp     = 0.0;
                const double temp        = startTemp + (endTemp - startTemp) * t / T;
                const double probability = exp((tmpscore - lastscore) / temp);
                const bool FORCE_NEXT    = probability > (double)(xrnd() % R) / R;
                
                if (tmpscore >= lastscore || FORCE_NEXT) {
                    lastscore = tmpscore;
                    if (tmpscore > bestscore) {
                        bestscore = tmpscore;
                        bestret = ret;
                    }
                } else {
                    ret[z] = tmp;
                }
                cnt += 1;
            }
            for (int z = 0; z < this->D; ++z) {
                int a = xrnd() % this->D;
                int b = xrnd() % this->D;
                swap(ret[a], ret[b]);
                
                double tmpscore = this->allScore(ret);
                
                const double T = saTimeEnd-saTimeStart;
                const double t = saTimeCurrent-saTimeStart;
                const double startTemp   = 8.0;
                const double endTemp     = 0.0;
                const double temp        = startTemp + (endTemp - startTemp) * t / T;
                const double probability = exp((tmpscore - lastscore) / temp);
                const bool FORCE_NEXT    = probability > (double)(xrnd() % R) / R;
                
                if (tmpscore >= lastscore || FORCE_NEXT) {
                    lastscore = tmpscore;
                    if (tmpscore > bestscore) {
                        bestscore = tmpscore;
                        bestret = ret;
                    }
                } else {
                    swap(ret[a], ret[b]);
                }
                cnt += 1;
            }
            // for (int z = 0; z < this->D; ++z) {
            //     int a = xrnd() % this->D;
            //     int b = xrnd() % this->D;
            //     int c = xrnd() % this->D;
            //     swap(ret[a], ret[b]);
            //     swap(ret[a], ret[c]);
                
            //     double tmpscore = this->allScore(ret);
                
            //     const double T = saTimeEnd-saTimeStart;
            //     const double t = saTimeCurrent-saTimeStart;
            //     const double startTemp   = 2.0;
            //     const double endTemp     = 0.0;
            //     const double temp        = startTemp + (endTemp - startTemp) * t / T;
            //     const double probability = exp((tmpscore - lastscore) / temp);
            //     const bool FORCE_NEXT    = probability > (double)(xrnd() % R) / R;
                
            //     if (tmpscore >= lastscore || FORCE_NEXT) {
            //         lastscore = tmpscore;
            //         if (tmpscore > bestscore) {
            //             bestscore = tmpscore;
            //             bestret = ret;
            //         }
            //     } else {
            //         swap(ret[a], ret[c]);
            //         swap(ret[a], ret[b]);
            //     }
            //     cnt += 1;
            // }
        }
        pdebug(cnt);
        return bestret;
    }
    
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    MM();
    
    return 0;
}


Measured memory_bytes: 4484