#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
const auto contest_duration = std::chrono::milliseconds(2500);
#else
#define NDEBUG
#include <bits/stdc++.h>
const auto contest_duration = std::chrono::milliseconds(1990);
#endif
const auto start_time = std::chrono::high_resolution_clock::now();
static bool timeout() {
    auto t = std::chrono::high_resolution_clock::now();
    return (t - start_time > contest_duration);
}

using namespace std;
using large = long long;

class XorShift {
  public:
    explicit XorShift(uint64_t x) : state_{x} {}
    uint64_t operator()() noexcept { return next(state_); }

  private:
    static constexpr uint64_t next(uint64_t x) noexcept {
        x ^= x << 13;
        x ^= x >> 7;
        x ^= x << 17;
        return x;
    }

    uint64_t state_;
};

static array<int, 26> C;
static array<array<int, 26>, 365> S; // S[day][type]
static array<int, 365> X;
static array<set<int>, 26> Days;

static large update(int d, int ty, large current_score) {
    auto dif = 0LL;
    auto ty0 = X[d];
    assert(ty0 != ty);
    X[d] = ty;

    // Removing
    {
        dif -= S[d][ty0];
        auto itr = Days[ty0].find(d);
        assert(itr != Days[ty0].begin() && itr != Days[ty0].end());
        auto prevpos = *(--itr);
        Days[ty0].erase(++itr);

        assert(Days[ty0].upper_bound(d) != Days[ty0].end());
        auto nextpos = *Days[ty0].upper_bound(d);
        dif -= (d - prevpos) * C[ty0] * (nextpos - d);
    }

    // Adding
    {
        dif += S[d][ty];
        auto [itr, inserted] = Days[ty].insert(d);
        assert(inserted);

        assert(itr != Days[ty].begin() && itr != Days[ty].end());
        auto prevpos = *(--itr);
        assert(Days[ty].upper_bound(d) != Days[ty].end());
        auto nextpos = *Days[ty].upper_bound(d);
        assert(prevpos < d && d < nextpos);
        dif += (d - prevpos) * C[ty] * (nextpos - d);
    }
    return current_score + dif;
}

static void solve() {
    auto rng = XorShift{std::random_device{}()};
    for (auto type = 0; type < 26; ++type) {
        Days[type].insert(-1);
        Days[type].insert(366);
    }

    auto sat = 0LL;
    {
        auto elapsed = array<int, 26>();
        for (auto d = 0; d < 365; ++d) {
            auto Csum = 0;
            for (auto t = 0; t < 26; ++t) {
                elapsed[t]++;
                Csum *= C[t] * elapsed[t];
            }

            auto s = array<large, 26>();
            for (auto t = 0; t < 26; ++t) {
                s[t] = S[d][t];
                s[t] -= Csum;
                s[t] += C[t] * elapsed[t];
            }
            auto itr = max_element(s.begin(), s.end());
            auto ty = int(distance(s.begin(), itr));

            elapsed[ty] = 0;
            sat += S[d][ty];
            for (auto t = 0; t < 26; ++t)
                sat -= C[t] * elapsed[t];

            X[d] = ty;
            Days[ty].insert(d);
        }
    }
    // cerr << "Init sat = " << sat << "\n";

    auto day = 0;
    auto step = 1LL;
    while (!timeout()) {
        // step = rng() % 16 + (rng() >> 60);
        // step += rng() % 16 + (rng() >> 60);
        // step = abs(step - 30) / 2 + 1;
        step = step + 1;
        if (step == 30)
            step = 1;

        for (auto rep = 200; rep--;) {
            const auto d = day;
            day = (day + step) % 365;

            const auto x0 = X[d];
            auto best_s = sat;
            auto best_x = x0;

            for (auto x = 0; x < 26; ++x) {
                if (x == x0)
                    continue;
                sat = update(d, x, sat);
                if (sat > best_s) {
                    best_s = sat;
                    best_x = x;
                }
            }

            if (best_x != X[d]) {
                sat = update(d, best_x, sat);
            }
            assert(sat == best_s);
        }
    }

    // cerr << "Result: " << sat << "\n";
}

int main() {
    int d;
    cin >> d;
    // assert(d == 365);
    for (auto& Ci : C)
        cin >> Ci;
    for (auto& row : S)
        for (auto& elem : row)
            cin >> elem;

    solve();

    // convert to 1-based
    for (auto Xi : X)
        cout << (Xi + 1) << "\n";
    return 0;
}


Measured memory_bytes: 3696