//{{{
#include<algorithm>
#include<cmath>
#include<cstring>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(printde) FUNC(printde4) FUNC(printdbe) FUNC(printdwe) FUNC(printdu);
#endif
template <template <class T, class = std::allocator<T>> class V, class E>
istream& operator >> (istream& in, V<E>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

#define LIMIT 2.0
// #define LIMIT 4.0

using scr = int;
mt19937 mt;

/*
TODO
*/

// structs
// {{{ Counter
struct Counter{
#ifdef LOCAL
#define COUNTER(name) Counter name(#name);
    int cnt = 0;
    string name;
    Counter(string name): name(name){ }
    ~Counter(){ printde(name, cnt); }
    void operator ++ (int){ cnt++; }
    void operator += (int d){ cnt += d; }
#else
#define COUNTER(name) Counter name;
    void operator ++ (int){ }
    void operator += (int){ }
#endif
};
// }}}
// COUNTER(cnt)
COUNTER(trial)
COUNTER(accepted)

// {{{ Watch
struct Watch {
    double prev;
    double getPrev(){
        return prev;
    }
#ifdef LOCAL
    timeval start;
    Watch(){
        gettimeofday(&start, nullptr);
    }
    double elapsed(){
        timeval now;
        gettimeofday(&now, nullptr);
        return prev = (now.tv_sec - start.tv_sec) + (now.tv_usec - start.tv_usec) / 1e6;
    }
#else
    double start;
#define ticks_per_sec 2800000000.0
    Watch(){
        start = get_time();
    }
    double elapsed(){
        return prev = get_time() - start;
    }
private:
    double get_time(){
        uint32_t lo, hi;
        asm volatile ("rdtsc" : "=a" (lo), "=d" (hi));
        return (((uint64_t)hi << 32) | lo) / ticks_per_sec;
    }
#endif
} watch;
// }}}

// {{{ Ans
struct Ans {
    scr score = -M;
    vector<int> ts;
    void output();
} bestAns;
// }}}

// constants
constexpr int D = 365;
int cs[26];
int ss[D][26];


// {{{ functions
// }}}


struct Problem : Ans{
    // variables
    vector<vector<int>> days;

    scr calcOne(int d1, int d2);
    scr calc();
    void makeInit();
    void solve();
    void initialize();
    void input();
    void updateBestScore(Ans& ans = bestAns);

};

void Problem::initialize(){ //{{{
    days.resize(26, vector<int>({-1, 365}));
    // days.resize(26, vector<int>({-1, 364}));
} //}}}

void Problem::updateBestScore(Ans& ans){ //{{{
    if(ans.score < score){
        ans = *this;
        printde("best", ans.score);
    }
} //}}}


scr Problem::calcOne(int d1, int d2){ //{{{
    int diff = d2 - 1 - d1;
    return diff * (diff + 1) / 2;
} //}}}

scr Problem::calc(){
    scr ret = 0;
    for(int i = 0; i < D; i++){
        ret += ss[i][ts[i]];
    }
    for(int i = 0; i < 26; i++){
        for(size_t j = 1; j < days[i].size(); j++){
            ret -= cs[i] * calcOne(days[i][j - 1], days[i][j]);
        }
    }
    return ret;
}

void Problem::makeInit(){ //{{{
    // vector<int> cacc(26);
    // for(int i = 0; i < 26; i++){
    //     cacc[i] = cs[i] + (i ? cacc[i - 1] : 0);
    // }
    // int acc = accumulate(cs, cs + 26, 0ll);
    // for(int i = 0; i < D; i++){
    //     int rd = mt() % acc;
    //     for(int j = 0; j < 26; j++){
    //         rd -= cs[j];
    //         if(rd < 0){
    //             ts.push_back(j);
    //             break;
    //         }
    //     }
    // }

    for(int i = 0; i < D; i++){
        ts.push_back(i % 26);
        // days[i % 26].push_back(i);
        days[i % 26].insert(days[i % 26].begin() + days[i % 26].size() - 1, i);
    }

    // for(int i = 0; i < D; i++){
    //     ts.push_back(0);
    //     maxi = ;
    //     for(int j = 1; j < 26; j++){
    //         ts.back() = j;
    //     }
    // }

    score = calc();
    bestAns = *this;
} //}}}

void Problem::solve(){
    static const double startT = 2000, endT = 0.1;
    int acc = 0;
    for(int i = 0; i < 26; i++){
        acc += days[i].size();
    }
    printde(acc);
    while(watch.elapsed() < LIMIT){
        double temp = startT + (endT - startT) * min(1.0, watch.getPrev() / LIMIT);
        for(int _ = 0; _ < 50; _++) {
            int d = mt() % D;

            scr diff = 0;

            int prev = ts[d];
            // auto dprev = days[prev];
            int dprev2;
            auto& dprev3 = days[prev];
            diff -= ss[d][prev];
            for(size_t i = 0; i < dprev3.size(); i++){
                auto& day = dprev3[i];
                if(day == d){
                    // printde(i, d, dprev3.size(), dprev3);
                    diff += cs[prev] * (calcOne(dprev3[i - 1], dprev3[i]) + calcOne(dprev3[i], dprev3[i + 1]));
                    diff -= cs[prev] * (calcOne(dprev3[i - 1], dprev3[i + 1]));
                    dprev2 = i;

                    // dprev3.erase(dprev3.begin() + i);
                    break;
                }
            }
            int next;
            do{
                next = mt() % 26;
            }while(prev == next);
            ts[d] = next;
            // auto dnext = days[next];
            int dnext2;
            auto& dnext3 = days[next];
            diff += ss[d][next];
            for(size_t i = 0; i < dnext3.size(); i++){
                auto& day = dnext3[i];
                if(d <= day){
                    diff += cs[next] * (calcOne(dnext3[i - 1], dnext3[i]));
                    diff -= cs[next] * (calcOne(dnext3[i - 1], d) + calcOne(d, dnext3[i]));
                    dnext2 = i;

                    // dnext3.insert(dnext3.begin() + i, d);
                    break;
                }
            }


            // scr cand = calc();
            // diff = cand - score;
            // printde(diff, calc() - score);
            // if(diff != calc() - score){
            //     printde(diff, calc() - score);
            //     printde(d);
            //     printde(cs[prev], ss[d][prev], dprev2, days[prev]);
            //     printde(cs[next], ss[d][next], dnext2, days[next]);
            //     exit(1);
            // }
            trial++;
            bool changeCond = true ? exp(diff / temp) * (1ull << 32) > mt() : diff >= 0;
            if(changeCond){
                accepted++;
                score += diff;
                    days[prev].erase(days[prev].begin() + dprev2);
                    days[next].insert(days[next].begin() + dnext2, d);
                updateBestScore();
            }else{
                ts[d] = prev;
                // days[prev] = dprev;
                // days[next] = dnext;
            }
        }
    }
    // printde(days);
    acc = 0;
    for(int i = 0; i < 26; i++){
        acc += days[i].size();
    }
    printde(acc);
}

// {{{ input output
void Problem::input(){
    int d; cin >> d;
    for(int i = 0; i < 26; i++){
        cin >> cs[i];
    }
    for(int i = 0; i < d; i++){
        for(int j = 0; j < 26; j++){
            cin >> ss[i][j];
        }
    }
}

void Ans::output(){
    for(int i = 0; i < D; i++){
        cout << ts[i] + 1 << '\n';
    }
}
// }}}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    Problem problem;
    problem.input();
    problem.initialize();
    problem.makeInit();
    problem.solve();
    bestAns.output();
}


Measured memory_bytes: 3860