#include <bits/stdc++.h>
#include <time.h>
#pragma GCC optimize("O3")
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

//var define
int d,initscore=0;
vector<int>c(26);
vector<int>t(365,0);
vector<vector<int>>s(365,vector<int>(26));
vector<int>last(26,0);

unsigned int randxor()
{
    static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned int t;
    t = (x ^ (x << 11));
    x = y;
    y = z;
    z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

vector<vector<int>>loss(26,vector<int>());

int getScore1(int d_x , int d_y,int score){

    //int score=0;
    score-=s[d_x][t[d_x]];
    score-=s[d_y][t[d_y]];
    score+=s[d_x][t[d_y]];
    score+=s[d_y][t[d_x]];
    REP(i,loss[t[d_x]].size()){
        if(loss[t[d_x]][i]==d_x){
            loss[t[d_x]].erase(loss[t[d_x]].begin()+i);
            break;
        }
    }
    loss[t[d_x]].push_back(d_y);
    sort(ALL(loss[t[d_x]]));
    REP(i,loss[t[d_y]].size()){
        if(loss[t[d_y]][i]==d_y){
            loss[t[d_y]].erase(loss[t[d_y]].begin()+i);
            break;
        }
    }
    loss[t[d_y]].push_back(d_x);
    sort(ALL(loss[t[d_y]]));
    for (int i = 0; i < 26; i++)
    {
        if(loss[t[i]].size()<=1) continue;
        for (int j = 0; j < (int)loss[i].size()-1; j++)
        {
            score-=(loss[i][j+1] - loss[i][j])*c[i];
        }
        
    }
    return score;
}

int getScore2(int d_x , int y,int score){

    score-=s[d_x][t[d_x]];
    score+=s[d_x][y];
    return score;

}

int getScore(){
      int score=0;
      vector<int>lastt(26,0);
      for (int i = 0; i < d; i++)
   {
       int x=t[i];
       lastt[x]=i+1;
       for (int j = 0; j < 26; j++)
       {
           score-=(i+1 - lastt[j])*c[j];
       }
       score+=s[i][x];
   }
   return score;
}

int tt;
vector<int>best(365,0);
int bestScore=-INF;
vector<int> yakinamashi(double msec,int nowscore)
{
    for (int i = 0; i < d; i++)
    {
        best[i]=t[i];
    }
    //show(best);
    //cerr<<"a";
    //bestScore = getScore1(0,0,nowscore);
    bestScore=getScore();
    int currentScore = bestScore;
    double saTimeStart = (double)clock() / CLOCKS_PER_SEC;
    double saTimeCurrent = saTimeStart;
    double saTimeEnd = saTimeStart + msec;
    int start_temp = 40, end_temp = 5;
    double TIME;

    while ((saTimeCurrent = (double)clock() / CLOCKS_PER_SEC) < saTimeEnd)
    {
        //cerr << (double)clock()/CLOCKS_PER_SEC << endl;
        double T = saTimeCurrent - saTimeStart;
        double temp = T;
        for (int loop = 0; loop < 50; loop++)
        {
            tt++;
            int index1 = randxor() % d;
            int index2 = randxor() % d;
            int tmp = t[index2];
            //swich
            t[index2] = t[index1];
            t[index1] = tmp;
            // int nextScore = currentScore - tmp_score + getScore2(index1, index2);
            //int nextScore = getScore1(index1,index2,currentScore);
            int nextScore=getScore();
            double TT = saTimeEnd - saTimeStart;
            
            //  int R = 10000;
            temp *= 0.99;
            TIME = static_cast<double>(saTimeEnd - saTimeStart);

            double prob = exp((double)(nextScore - currentScore) / temp);
            //bool FORCE_NEXT = R * (T - t) > T * (randxor() % R);
            //  次に遷移
            if (nextScore > currentScore || (prob > (randxor() % (unsigned ll)(1e18) / (double)(1e18))))
            {
                currentScore = nextScore;
                //printf("New best Score=%d time=%lf\n", bestScore, t);
            }
            //遷移しない時は戻す
            else
            {
                t[index1] = t[index2];
                t[index2] = tmp;
            }

            //bestScore
            if (currentScore > bestScore)
            {
                bestScore = currentScore;
                //best[index1][index2] = seq[index1][index2];
                //cerr<<bestScore<<endl;
               // COUT(bestScore);
                for (int i = 0; i < d; i++)
                {

                    best[i] = t[i];
                }
                //cerr<<"a";
                //printf("New best Score=%d time=%lf\n", bestScore, t);
            }
        }
    }
    return best;
}



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>d;
  
    for (int i = 0; i < 26; i++)
    {
        cin>>c[i];
    }
    
    for (int i = 0; i < d; i++)
    {
        for (int j = 0; j < 26; j++)
        {
            cin>>s[i][j];
        }
    }
    //cerr<<"a";
    for (int i = 0; i < 26; i++)
    {
        loss[i].push_back(-1);
    }
    for (int i = 0; i < d; i++)
    {
        //t[i]=randxor()%26;
        t[i]=i%26;
        initscore+=s[i][t[i]];
        loss[t[i]].push_back(i);
    }
    /*for (int i = 0; i < d; i++)
    {
        int maxn=0;
        int id=-1;
        for (int j = 0; j < 26; j++)
        {
            if(maxn<=s[i][j]){
                maxn=s[i][j];
                id=j;
            }
        }
        t[i]=id;
    }*/
  /*  t[0]=0;
    t[1]=16;
    t[2]=12;
    t[3]=13;
    t[4]=12;*/
   
    
   for (int i = 0; i < d; i++)
   {
       int x=t[i];
       last[x]=i+1;
       for (int j = 0; j < 26; j++)
       {
           initscore-=(i+1 - last[j])*c[j];
       }
       initscore+=s[i][x];
   }
   
    //show(t);
    vector<int>ans=yakinamashi(1.95,initscore);
    //cerr<<"a";
    for (int i = 0; i < d; i++)
    {
        cout<<t[i]+1<<endl;
    }
  //cerr<<bestScore<<endl;
   // cerr<<initscore<<endl;
    /*for (int i = 0; i < 5; i++)
    {
        cerr<<s[i][t[i]]<<endl;
    }*/
    
    
    return 0;
}

Measured memory_bytes: 4332