#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define miele(v) min_element(v.begin(), v.end())
#define maele(v) max_element(v.begin(), v.end())
#define SUM(v) accumulate(v.begin(), v.end(), 0LL)
#define lb(a, key) lower_bound(a.begin(),a.end(),key)
#define ub(a, key) upper_bound(a.begin(),a.end(),key)
#define COUNT(a, key) count(a.begin(), a.end(), key) 
#define BITCOUNT(x) __builtin_popcount(x)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
using P = pair <int,int>;
using WeightedGraph = vector<vector <P>>;
using UnWeightedGraph = vector<vector<int>>;
using Real = long double;
using Point = complex<Real>; //Point and Vector2d is the same!
using Vector2d = complex<Real>;
const long long INF = 1LL << 60;
const int MOD = 1000000007;
const double EPS = 1e-15;
const double PI=3.14159265358979323846;
template <typename T> 
int getIndexOfLowerBound(vector <T> &v, T x){
    return lower_bound(v.begin(),v.end(),x)-v.begin();
}
template <typename T> 
int getIndexOfUpperBound(vector <T> &v, T x){
    return upper_bound(v.begin(),v.end(),x)-v.begin();
}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define DUMPOUT cerr
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
istream &operator>>(istream &is, Point &p) {
    Real a, b; is >> a >> b; p = Point(a, b); return is;
}
template <typename T, typename U>
istream &operator>>(istream &is, pair<T,U> &p_var) {
    is >> p_var.first >> p_var.second;
    return is;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    DUMPOUT<<'{';
    os << pair_var.first;
    DUMPOUT<<',';
    os << " "<< pair_var.second;
    DUMPOUT<<'}';
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
    DUMPOUT<<'[';
    for (int i = 0; i < vec.size(); i++) 
    os << vec[i] << (i + 1 == vec.size() ? "" : " ");
    DUMPOUT<<']';
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<vector<T>> &df) {
  for (auto& vec : df) os<<vec;
  return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    DUMPOUT << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) DUMPOUT << ", ";
        itr--;
    }
    DUMPOUT << "}";
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    DUMPOUT << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) DUMPOUT << ", ";
        itr--;
    }
    DUMPOUT << "}";
    return os;
}
void print() {cout << endl;}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
void dump_func() {DUMPOUT << '#'<<endl;}
template <typename Head, typename... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) DUMPOUT << ", ";
    dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
int d = 365;
vector <int> c(26);
vector <vector<int>> s(365,vector <int>(26));
vector <int> ans(365);
int score;
int ld[26];
vector <int> t = {92, 54, 230, 44, 89, 95, 54,88, 89,347, 328, 5, 138, 42, 141, 190, 178, 182, 51, 75, 277, 322, 165, 218, 105, 130, 183, 107, 274, 356, 229, 98, 177, 364, 170, 195, 234, 357, 151, 290, 194, 49, 254, 147, 197, 223, 219, 55, 269, 100, 307, 311, 77, 141, 58, 188, 337, 46, 74, 27, 300, 49, 248, 229, 207, 346, 75, 168, 204, 251, 35, 172, 173, 343, 157, 93, 270, 23, 239, 214, 317, 78, 308, 226, 137, 144, 69, 138, 260, 250, 121, 297, 290, 2, 176, 320, 335, 205, 18, 306, 131, 189, 77, 303, 42, 216, 45, 51, 21,141, 1, 108, 3, 114, 230, 97, 122, 89, 293, 221, 351, 153, 334, 64, 37, 223, 140, 256, 126, 210, 7, 329, 31, 192, 61, 97, 305, 296, 13, 86, 233, 85, 183, 32, 324, 235, 354, 349, 282, 172, 79, 37, 99, 168, 135, 26, 207, 239, 11, 314, 217, 290, 192, 334, 22, 348, 284, 104, 241, 289, 341, 218, 245, 160, 72, 11, 127, 34, 10, 21, 20, 291, 329, 117, 324, 201, 65, 43, 52, 364, 242, 321, 100, 17, 308, 3, 47, 184, 189, 120, 259, 126, 84, 67, 357, 99, 79, 223, 344, 77, 343, 115, 298, 344, 279, 258, 184, 106, 287, 151, 17, 160, 288, 49, 80, 72, 199, 260, 282, 24, 179, 60, 51, 13, 4, 180, 347, 253, 320, 288, 259, 189, 264, 187, 256, 267, 233, 281, 359, 81, 280, 31, 145, 115, 52, 65, 144, 60, 96, 360, 112, 71, 99, 279, 178, 264, 88, 128, 249, 20, 125, 267, 232, 5, 301, 94, 72, 165, 278, 101, 294, 280, 167, 200, 142, 277, 166, 117, 78, 125, 307, 187, 20, 140, 33, 252, 265, 48, 241, 85, 70, 207, 329, 105, 238, 17, 240, 306, 201, 295, 211, 15, 212, 110, 187, 136, 203, 355, 279, 203, 208, 209, 303, 216, 204, 147, 216, 231, 212, 102, 91, 323, 259, 280, 231, 226, 228, 171, 123, 292, 139, 185, 332, 88, 319, 167, 232, 107, 254, 217, 167, 156, 147, 144, 263, 125, 151, 338, 107, 179, 109, 174, 343, 84, 349, 128, 131, 185, 266, 267, 166, 113, 84, 188, 145, 228, 197, 235, 363, 147, 256, 189, 302, 246, 339, 207, 151, 245, 151, 214, 191, 122, 173, 218, 129, 306, 103, 340, 274, 103, 307, 154, 106, 119, 124, 175, 265, 86, 80, 146, 85, 222, 126};
struct Timer {
  chrono::high_resolution_clock::time_point st;

  Timer() { reset(); }

  void reset() {
    st = chrono::high_resolution_clock::now();
  }

  chrono::milliseconds::rep elapsed() {
    auto ed = chrono::high_resolution_clock::now();
    return chrono::duration_cast< chrono::milliseconds >(ed - st).count();
  }
};

int calc_score(vector <int> &ans){
    int res = 0;
    for(int i=0;i<26;i++) ld[i] = -1;
    for(int i=0;i<365;i++){
        for(int j=0;j<26;j++){
            if(ans[i]-1 == j) res += s[i][j], ld[j] = i;
            else {
                res -= (i - ld[j])*c[j];
            }
        }
    }
    return res;
}

void modify(vector <int> nans, int x){
    x %= t.size();
    int key = t[x];
    x = key;
    if(x == 0) return ;
    int cnt = 2;
    while(x < 365){
        int ind=0;
        int ma=0;
        for(int j=0;j<26;j++){
            if(j == ans[x]-1) continue;
            if(chmax(ma, s[x][j])) ind = j+1;
        }
        ans[x] = ind;
        x = key*cnt, cnt++;
    }
    if(chmax(score, calc_score(nans))) ans = nans;
}
signed main(void) { cin.tie(0); ios::sync_with_stdio(false);
    Timer timer;
    cin>>d;
    cin>>c;
    cin>>s;
    vector <int> ld(26, -1);
    for(int i=0;i<d;i++){
        int ma = 0;
        int ind = 1;
        for(int j=0;j<26;j++){
            s[i][j] += (i - ld[j]) * c[j];
            if(chmax(ma, s[i][j])) ind = j+1;
        }
        ans[i] = ind;
        ld[ind-1] = i;
    }
    score = calc_score(ans);
    int x = 0;
    while(timer.elapsed() < 1980){
        modify(ans, x++);
    }
    rep(i, 365) print(ans[i]);
}


Measured memory_bytes: 3772