#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

typedef pair<double, double> pd;
typedef vector<pd> vpd;


#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> t chmax(t&a,u b){if(a<b)a=b; return a;};
template<class t, class u> t chmin(t&a,u b){if(a>b)a=b; return a;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

ll D;
vll c(26);
vvll s;

vvll t;
vvll last;
vvll ans_vec;

ll K = 2;

void update(ll& ans, vll& t, vvll& last, ll d, ll q){
  ans -= s[d][t[d]];
  ll old_q = t[d];

  t[d] = q;
  ans += s[d][t[d]];

  ll prev_val = last[d+1][old_q];
  ll old_q_last = last[d][old_q];
  ll diff_old = abs(prev_val-last[d][old_q]);

  ll new_q_last = last[d+1][q];
  ll diff_new = abs((d+1)-last[d+1][q]);

  FOR(i,d+1,D+1){
    if(last[i][old_q]==prev_val){
      ans += c[old_q]*(prev_val-old_q_last);
      last[i][old_q] = old_q_last;
    }
    if(last[i][q]==new_q_last){
      ans -= c[q]*diff_new;
      last[i][q] = d+1;
    }
  }
}

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  clock_t start = clock();

  IN(D);
  REP(i,26){
    IN(c[i]);
  }
  s.resize(D, vll(26));
  vll s_max(D, 0);
  REP(i,D){
    REP(j,26){
      IN(s[i][j]);
      if(s[i][s_max[i]]<s[i][j]){
        s_max[i] = j;
      }
    }
  }
  ans_vec.resize(K, vll(D+1, 0));
  last.resize(K, vll(26, 0));
  t.resize(K, vll(D));

  REP(i,D){
    //t[i] = s_max[i];
    vector<pair<ll, pair<vll, pair<vll, vll>>>> hoge;
    REP(j,K){
      REP(k,26){

        ll cost = ans_vec[j][i];
        t[j][i] = k;
        cost += s[i][k];
        ll prev_last = last[j][k];
        last[j][k] = i+1;
        REP(l,26){
          cost -= c[l]*(i+1-last[j][l]);
        }
        ans_vec[j][i+1] = cost;

        hoge.push_back(make_pair(cost, make_pair(ans_vec[j], make_pair(t[j], last[j]))));

        last[j][k] = prev_last;
      }
    }

    sort(ALL(hoge));
    reverse(ALL(hoge));

    REP(j,K){
      ans_vec[j] = hoge[j].second.first;
      t[j] = hoge[j].second.second.first;
      last[j] = hoge[j].second.second.second;
    }
  }
  //calc(0);
  
  ll ans_2 = ans_vec[0][D];
  vll t_2 = t[0];
  vvll last_2(D+1, vll(26, 0));
  REP(i,D){
    last_2[i+1] = last_2[i];
    last_2[i+1][t_2[i]] = i+1;
  }

  srand(0);

  ll M = 0;
  REP(i,M){
    ll d = rand()%D;
    ll q = rand()%26;

    ll ans_2_copy = ans_2;
    vll t_2_copy = t_2;
    vvll last_2_copy = last_2;

    update(ans_2, t_2, last_2, d, q);

    /*
    if(ans_2 < ans_2_copy){
      ans_2 = ans_2_copy;
      t_2 = t_2_copy;
      last_2 = last_2_copy;
    }
    */

    clock_t end = clock();
    if((end-start)/CLOCKS_PER_SEC > 1.8){
      break;
    }
  }

  REP(i,D){
    //printf("%lld\n", t[0][i]+1);
    printf("%lld\n", t_2[i]+1);
  }

  //fprintf(stderr, "score : %lld\n", ans_vec[0][D]);
  fprintf(stderr, "score : %lld\n", ans_2);

  return 0;
}

Measured memory_bytes: 4188