#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <chrono>
#include <random>

#include <cstring>

using namespace std;

using ll = long long;
using ull = unsigned long long;
ll const MM = 1000000007;
//ll const NN = 1000000007;

#define pv(val) cerr << #val << '=' << (val) << endl
#define pl cerr << '@' << __LINE__ << endl

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, b, e) for (ll i = (b); i < (e); i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

template <class T>
ostream& operator<<(ostream& os, vector<T> const& vec);
template <class T, size_t S>
ostream& operator<<(ostream& os, array<T, S> const& arr);
template<class T, class U>
ostream& operator<<(ostream& os, pair<T, U> const& p);
template<class... Args>
ostream& operator<<(ostream& os, tuple<Args...> const& t);

template <class T>
ostream& operator<<(ostream& os, vector<T> const& vec) {
    if (vec.empty()) {
        os << "{}";
    } else {
        os << '{';
        for (size_t i = 0; i < vec.size() - 1; i++) os << vec[i] << ", ";
        os << vec.back() << '}';
    }
    return os;
}

template <class T, size_t S>
ostream& operator<<(ostream& os, array<T, S> const& arr) {
    if (arr.empty()) {
        os << "{}";
    } else {
        os << '{';
        for (size_t i = 0; i < arr.size() - 1; i++) os << arr[i] << ", ";
        os << arr.back() << '}';
    }
    return os;
}

template<class T, class U>
ostream& operator<<(ostream& os, pair<T, U> const& p) {
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<size_t I, class... Args>
typename enable_if<sizeof...(Args) == (I + 1)>::type print_tuple(ostream& os, tuple<Args...> const& t) {
    os << get<I>(t);
}
template<size_t I, class... Args>
typename enable_if<sizeof...(Args) != (I + 1)>::type print_tuple(ostream& os, tuple<Args...> const& t) {
    os << get<I>(t) << ", ";
    print_tuple<I + 1, Args...>(os, t);
}

template<class... Args>
ostream& operator<<(ostream& os, tuple<Args...> const& t) {
    os << '(';
    print_tuple<0, Args...>(os, t);
    os << ')';

    return os;
}

struct Timer {
    using Clock = std::chrono::system_clock;
    Clock::time_point startTime;
 
    Timer()
    {
        start();
    }
    void start()
    {
        startTime = Clock::now();
    }
 
    long long milli() const
    {
        return std::chrono::duration_cast<std::chrono::milliseconds>(Clock::now() - startTime).count();
    }
    long long micro() const
    {
        return std::chrono::duration_cast<std::chrono::microseconds>(Clock::now() - startTime).count();
    }
};

ll bound(function<bool(ll)> f, ll ng, ll ok) {
    while (abs(ng - ok) > 1) {
        ll mid = (ng + ok) / 2;
        if (f(mid))
            ok = mid;
        else
            ng = mid;
    }

    return ok;
}

ll order(vector<ll> const& r) {
    vector<ll> a(r.size());
    iota(all(a), 1);

    ll ord = 0;
    while (a != r) {
        next_permutation(all(a));
        ord++;
    }

    return ord;
}

ll div(ll n) {
    ll ans = 0;
    while (n > 0) {
        ans++;
        n /= 2;
    }

    return ans;
}

//value, weight
ll knapsack(vector<pair<ll, ll>> const& a, ll max_w) {
    ll max_n = a.size();
    vector<ll> table(max_w + 1, 0);

    for (int i = 1; i <= max_n; ++i) {
        ll v = a[i].first;
        ll w = a[i].second;
        if (w <= max_w && table[w] < v)
            table[w] = v;
        for (int j = 1; j <= max_w - w; j++) {
            if (table[j] != 0 && table[w + j] < table[j] + v)
                table[w + j] = table[j] + v;
        }
    }

    return *max_element(all(table));
}

ll llpow(ll n, ll m) {
    ll ans = 1;
    rep(i, m) {
        ans *= n;
        ans %= MM;
    }

    return ans;
}

Timer gTimer;

ll D;
array<int, 26> c;
array<array<int, 26>, 365> s;
ll score(array<int, 365> const& ans){
    ll sc = 0;
    array<int, 26> last = {};
    rep(d, 365) {
        last[ans[d]] = d + 1;
        rep(i, 26)
            sc -= c[i] * (d + 1 - last[i]);
        sc += s[d][ans[d]];
    }

    return sc;
}

ll scoreDiff(array<int, 365> const& ans, ll i){
    ll sc = 0;
    ll last = 0;
    rep(d, 365){
        if(ans[d] == i){
            last = d + 1;
            sc += s[d][i];
        }
        sc -= c[i] * (d + 1 - last);
    }

    return sc;
}

int main(void) {
    array<int, 365> ans;

    cin >> D;
    rep(i, 26)
        cin >> c[i];
    rep(d, 365) rep(i, 26)
        cin >> s[d][i];

    uniform_int_distribution<int> dist26(0, 25);
    uniform_int_distribution<int> dist365(0, 364);
    uniform_int_distribution<int> dist_1010(-20, 20);
    uniform_real_distribution<double> dist01(0.0, 1.0);
    mt19937 mt;
    rep(d, 365)
        ans[d] = distance(s[d].begin(), max_element(all(s[d])));
    
    array<array<int, 365>, 26> last;

    ll currentScore = score(ans);
    auto bestAns = ans;
    ll bestScore = currentScore;

    ll const timeLimit = 1950;

    double a = 5000.0, b = 100.0;

    ll nIters = 0;
    while(true){
        int const timeMicro = gTimer.micro();
        if(timeMicro  >= timeLimit * 1000)
            goto NEXT;
        double const prog = timeMicro / (timeLimit * 1000.0);
        double const progg = 1.0 - prog;

        rep(_, 5){
            int const d = dist365(mt);
            int const i = dist26(mt);
            if(ans[d] == i)
                continue;
            if(s[d][i] <= 15000)
                continue;
            int const prev = ans[d];
            int const a0 = scoreDiff(ans, prev);
            int const b0 = scoreDiff(ans, i);
            ans[d] = i;
            int const a1 = scoreDiff(ans, prev);
            int const b1 = scoreDiff(ans, i);
            int const nextScore = currentScore - (a0 + b0) + (a1 + b1);
            int const diff = nextScore - currentScore;
            ++nIters;
            if (diff >= 0 || exp(diff / (a * progg + b)) > dist01(mt)) {
                if(nextScore > bestScore){
                    bestScore = nextScore;
                    bestAns = ans;
                }
                currentScore = nextScore;
            } else {
                ans[d] = prev;
            }
        }
        rep(_, 10) {
            int const d0 = dist365(mt);
            int const d1 = clamp(d0 + dist_1010(mt), 0, 364);
            int const a0 = scoreDiff(ans, ans[d0]);
            int const b0 = scoreDiff(ans, ans[d1]);
            swap(ans[d0], ans[d1]);
            int const a1 = scoreDiff(ans, ans[d0]);
            int const b1 = scoreDiff(ans, ans[d1]);
            int const nextScore = currentScore - (a0 + b0) + (a1 + b1);
            int const diff = nextScore - currentScore;
            ++nIters;
            if (diff >= 0 || exp(diff / (a * progg + b)) > dist01(mt)) {
                if(nextScore > bestScore){
                    bestScore = nextScore;
                    bestAns = ans;
                }
                currentScore = nextScore;
            } else {
                swap(ans[d0], ans[d1]);
            }
        }
    }

    NEXT:
    ans = bestAns;
    currentScore = bestScore;
    pv(nIters);

    rep(d, 365)
        cout << bestAns[d] + 1 << endl;

    return 0;
}



Measured memory_bytes: 3776