#include <bits/stdc++.h>
using namespace std;
#define PII pair<int, int>
#define VI vector<int>
#define VPII vector<PII>
#define LL long long
#define LD long double
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
#define SIZ(c) (int)(c).size()
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, b, e) for(int i = (b); i <= (int)(e); ++i)
#define FORD(i, b, e) for(int i = (b); i >= (int)(e); --i)

#define sim template<class n
sim, class s> ostream & operator << (ostream &p, pair<n, s> x)
{return p << "<" << x.f << ", " << x.s << ">";}
sim> auto operator << (ostream &p, n y) ->
typename enable_if<!is_same<n, string>::value, decltype(y.begin(), p)>::type 
{int o = 0; p << "{"; for(auto c: y) {if(o++) p << ", "; p << c;} return p << "}";}
void dor() {cerr << endl;}
sim, class...s> void dor(n p, s...y) {cerr << p << " "; dor(y...);}
sim, class s> void mini(n &p, s y) {if(p>y) p = y;}
sim, class s> void maxi(n &p, s y) {if(p<y) p = y;}
#ifdef DEB
#define debug(...) dor(__FUNCTION__, ":", __LINE__, ": ", __VA_ARGS__)
#else
#define debug(...)
#endif 

#define I(x) #x " =", (x), " "
#define A(a, i) #a "[" #i " =", i, "] =", a[i], " "

int R(int a, int b){return rand()%(b-a+1)+a;}

const int MXD = 400;
int res[MXD];
int ever_best = -1e9;
int contest[MXD];
int s[MXD][28];
int c[28];

int last[28];
set<int> when[28];
int D;
int sc;


void clear()
  {
  FOR(i, 1, 26)when[i].clear();
  FOR(i, 1, 26)when[i].insert(0);
  FOR(i, 1, 26)when[i].insert(D+1);
  FOR(i, 1, 26)last[i] = 0;
  sc = 0;
  }

void check()
  {
  if(sc > ever_best)
    {
    ever_best = sc;
    FOR(i, 1, D)res[i] = contest[i];
    }
  }

void random_sol()
  {
  FOR(i, 1, D)contest[i] = R(1, 26);
  }
void get_score()
  {
  sc = 0;

  FOR(i, 1, D)
    {
    sc += s[i][contest[i]];
    last[contest[i]] = i;
    FOR(j, 1, 26)
      sc -= c[j] * (i - last[j]);

    when[contest[i]].insert(i);
    }
  }
void zachlan()
  {
  sc = 0;

  FOR(i, 1, D)
    {
    int best = -1;
    int best_val = -1e9;

    int minus = 0;

    FOR(j, 1, 26)
      {
      int cand = s[i][j] + c[j] * (i - last[j]);
      minus += c[j] * (i - last[j]);
      if(cand > best_val)
        {
        best_val = cand;
        best = j;
        }
      }
    contest[i] = best;

    when[contest[i]].insert(i);
    sc += best_val - minus;
    last[contest[i]] = i;
    }
  }

int cost(int day, int who)
  {
  int prev = *--when[who].upper_bound(day-1);
  int nxt = *when[who].upper_bound(day);

  int ile = day - prev;
  int razy = nxt - day;
  return ile * razy * c[who];
  }
// int cost_dodam(int day, int who)
//   {
//   int prev = *--when[who].upper_bound(day-1);
//   int nxt = *when[who].upper_bound(day);

//   int ile = day - prev;
//   int razy = nxt - day;
//   return ile * razy * c;
//   }


LD max_time = 1.9;

void poprawiaj()
  {
  int iter = 0;
  while(clock() < max_time * CLOCKS_PER_SEC)
    {
    int day = R(1, D);
    int who = contest[day];

    sc = sc - cost(day, who) - s[day][who];
    when[who].erase(day);

    int best = 0;
    int best_val = -1e9;
    FOR(i, 1, 26)
      {
//      debug(day, i, cost(day, i));

      int cand = cost(day, i) + s[day][i];
      if(cand > best_val)
        {
        best_val = cand;
        best = i;
        }
      }

//    debug(who, best, best_val);
    
    when[best].insert(day);
    contest[day] = best;
    sc += best_val;

    if(iter % 1000 == 0)debug(I(sc), iter);
//    break;
    iter++;
    check();
    if(iter > 4000)break;
    }
  }


int main()
  {
  cin >> D;

  FOR(i, 1, 26)scanf("%d", &c[i]);
  FOR(i, 1, D)
    {
    FOR(j, 1, 26)scanf("%d", &s[i][j]);
    }


  while(clock() < max_time * CLOCKS_PER_SEC)
    {
    clear();
    zachlan();
    debug(I(ever_best));  
    poprawiaj();
    }


  FOR(i, 1, D)cout << res[i] << endl;
  }


Measured memory_bytes: 3832