#include <iostream>
#include <vector>
#include <unordered_map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <climits>
#include <utility>
#include <tuple>
#include <random>
#include <cmath>
#include <iterator>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int (i)=1;(i)<=(n);(i)++)

using namespace std;

class Xorshift{
    public:
        using result_type = uint_fast32_t;

        /**
         * @brief returns minimum value
         *
         * @return minimum value
         */
        inline static constexpr unsigned min(){
            return 0u;
        }

        /**
         * @brief returns maximum value
         *
         * @return maximum value
         */
        inline static constexpr unsigned max(){
            return UINT_MAX;
        }

        /**
         * @brief generate random number
         *
         * @return random number
         */
        inline unsigned operator()(){
            unsigned t = x ^ (x << 11);
            x = y;
            y = z;
            z = w;
            return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
        }

        /**
         * @brief Xorshift constructor
         */
        Xorshift(){
            std::random_device rd;
            w=rd();
        }

        /**
         * @brief Xorshift constructor with seed
         *
         * @param s seed
         */
        Xorshift(unsigned s){
            w=s;
        }
    private:
        unsigned x=123456789u,y=362436069u,z=521288629u,w;
};


constexpr int TYPE = 26;
int D;
vector<int> c;
vector<int> s;

inline int _(int d, int i){
    return TYPE*d + i;
}

inline int score(const vector<int>& t){
    vector<int> last(TYPE, 0);
    int ret = 0;
    rep(d,D){
        ret += s[_(d,t[d]-1)];
        last[t[d]-1] = d+1;
        rep(i,TYPE){
            ret -= c[i]*(d+1-last[i]);
        }
    }
    return ret;
}

inline void swap(vector<int>& t, double beta, Xorshift& rand_gen){
    static auto uid = std::uniform_int_distribution<>(0,D-1);
    static auto uid2 = std::uniform_int_distribution<>(1,TYPE);
    static auto urd = std::uniform_real_distribution<>(0,1.0);
    int pos = uid(rand_gen);
    int new_val = uid2(rand_gen);
    int old_val = t[pos];
    double Ebef = -score(t);
    t[pos] = new_val;
    double Eaft = -score(t);
    t[pos] = old_val;
    double dE = Eaft - Ebef;
    if (dE < 0 || std::exp(-beta*dE) > urd(rand_gen)){
        t[pos] = new_val;
    }
}

template<typename T = double>
class Logspace {
private:
    T curValue, base, step;

public:
    Logspace(T first, T last, int num, T base = 10.0) : curValue(first), base(base){
       step = (last - first)/(num-1);
    }

    T operator()() {
        T retval = pow(base, curValue);
        curValue += step;
        return retval;
    }
};

int main(int argc, char const* argv[])
{
    c.resize(TYPE);
    cin >> D;
    rep(i,TYPE){
        cin >> c[i];
    }
    s.resize(D*TYPE);
    rep(d,D){
        rep(i,TYPE){
            cin >> s[_(d,i)];
        }
    }

    Xorshift rand_gen(0x1234);

    vector<int> t;
    static auto uid2 = std::uniform_int_distribution<>(1,TYPE);
    for(int d=0; d<D; d++){
        t.push_back(uid2(rand_gen));
    }

    vector<double> beta_array;
    int num = 1000;
    std::generate_n(std::back_inserter(beta_array), num, Logspace<>(std::log10(0.1),std::log10(50),num));
    for(double beta : beta_array){
        swap(t, beta, rand_gen);
    }
    for(int elem : t){
        cout << elem << endl;
    }

    return 0;
}


Measured memory_bytes: 4240