//{{{
#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<int> lasts(26);
    vector<vector<int>> days;

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

};

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

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


void Problem::calcOne(int d){ //{{{
} //}}}

scr Problem::calc(){
    scr ret = 0;
    vector<int> lasts(26);
    for(int i = 0; i < D; i++){
        ret += ss[i][ts[i]];
    }
    auto cal = [&](int d1, int d2){ 
        int diff = d2 - d1;
        return diff * (diff + 1) / 2;
    };
    for(int i = 0; i < 26; i++){
        for(size_t j = 0; j < days[i].size(); j++){
            ret -= cs[i] * cal(days[i][j], j + 1 == days[i].size() ? 364 : days[i][j + 1] - 1);
            // ret -= cs[i] * cal(j ? days[i][j - 1] : -1, days[i][j] - 1);
            // ret -= cs[i] * cal(j ? days[i][j - 1] : 0, days[i][j]);
        }
    }
    // printde(days);
    // printde(ret);

    // for(int i = 0; i < D; i++){
    //     // printde(i, ts[i]);
    //     ret += calcOne(i);
    //     // ret += ss[i][ts[i]];
    //     lasts[ts[i]] = i + 1;
    //     for(int j = 0; j < 26; j++){
    //         ret -= cs[j] * ((i + 1) - lasts[j]);
    //     }
    // }
    // printde(ts);
    // printde(ret);
    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);
    }

    // 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;
            int prev = ts[d];
            auto dprev = days[prev];
            for(size_t i = 0; i < days[prev].size(); i++){
                auto& day = days[prev][i];
                if(day == d){
                    days[prev].erase(days[prev].begin() + i);
                    break;
                }
            }
            int next;
            do{
                next = mt() % 26;
            }while(prev == next);
            ts[d] = next;
            auto dnext = days[next];
            for(size_t i = 0; i < days[next].size(); i++){
                auto& day = days[next][i];
                if(d <= day){
                    days[next].insert(days[next].begin() + i, d);
                    break;
                }
            }
            scr cand = calc();
            scr diff = cand - score;
            trial++;
            bool changeCond = true ? exp(diff / temp) * (1ull << 32) > mt() : diff >= 0;
            if(changeCond){
                accepted++;
                score = cand;
                updateBestScore();
            }else{
                ts[d] = prev;
                days[prev] = dprev;
                days[next] = dnext;
            }
        }
    }
    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: 3864