// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



long long calc(int n, const vector<int>& options, const vector<int>& cost,

               const vector<array<int, 26>>& s, int dd, int nt, int ot) {

  //long long x(total);

  int before(dd-1), after(dd+1);

  while (before >= 0 && options[before] != nt) before--;

  while (after < n && options[after] != nt) after++;

  int a(dd - before - 1), b(after - dd - 1), c(after - before - 1);

  int diff = c * (c+1) / 2 - a * (a+1) / 2 - b * (b+1) / 2;

  int before2(dd-1), after2(dd+1);

  while (before2 >= 0 && options[before2] != ot) before2--;

  while (after2 < n && options[after2] != ot) after2++;

  int a2(dd - before2 - 1), b2(after2 - dd - 1), c2(after2 - before2 - 1);

  int diff2 = c2 * (c2+1) / 2 - a2 * (a2+1) / 2 - b2 * (b2+1) / 2;

  return + (long long) diff * cost[nt] - (long long) diff2 * cost[ot] + s[dd][nt] - s[dd][ot];

}

int main() {

  int n;

  cin >> n;

  vector<int> c(26);

  vector<array<int, 26>> s(n);

  

  vector<int> last(26, -1);

  

  for (int i = 0; i < 26; ++i)

    cin >> c[i];

  for (int i = 0; i < n; ++i)

    for (int j = 0; j < 26; ++j)

      cin >> s[i][j];

  

  long long total(0);

  vector<int> options(n);

  

  for (int i = 0; i < n; ++i) {

    int neg(0), test(-1);

    for (int j = 0; j < 26; ++j) {

      neg -= c[j] * (i - last[j]);

    }

    //cout << neg << 'n' << endl;

    int max_score = -1e9;

    for (int j = 0; j < 26; ++j) {

      int ss = s[i][j] + neg + c[j] * (i - last[j]);

      if (ss > max_score) {

        max_score = ss;

        test = j;

      }

    }

    total += max_score;

    //cout << test + 1 << endl;

    options[i] = test;

    //cout << test + 1 << ' ' << max_score << endl;

    last[test] = i;

  }

  //cout << total << endl;

  for (int t = 1; t <= 500; ++t) {

    for (int dd = n - 1; dd >= 0; --dd) {

      for (int tt = 25; tt >= 0; --tt) {

        if (tt == options[dd]) continue;

        int ot = options[dd];

        

        long long ns = calc(n, options, c, s, dd, tt, ot);

        //cout << ns << endl;

        if (ns > 0) {

      		total += ns;

          options[dd] = tt;

    	}

      }

    }

  }

  for (const int& i: options) cout << i + 1 << endl;

  //cout << total << endl;

  return 0;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

 

long long calc(int n, int c1, int c2, int s1, int s2, const vector<int>& options,

               int d, int nt, int ot) {

  int b1(d-1), a1(d+1), b2(d-1), a2(d+1);

  while (b1 >= 0 && options[b1] != nt) b1--;

  while (b2 >= 0 && options[b2] != ot) b2--;

  while (a1 < n && options[a1] != nt) a1++;

  while (a2 < n && options[a2] != ot) a2++;

  int x1(d-b1-1), y1(a1-d-1), z1(a1-b1-1), x2(d-b2-1), y2(a2-d-1), z2(a2-b2-1);

  int diff1 = z1*(z1+1)/2-x1*(x1+1)/2-y1*(y1+1)/2;

  int diff2 = z2*(z2+1)/2-x2*(x2+1)/2-y2*(y2+1)/2;

  return (long long) diff1 * c1 - (long long) diff2 * c2 + s1 - s2;

}

 

int main() {

  int n;

  cin >> n;

  vector<int> c(26);

  vector<array<int, 26>> s(n);

  

  vector<int> last(26, -1);

  

  for (int i = 0; i < 26; ++i)

    cin >> c[i];

  for (int i = 0; i < n; ++i)

    for (int j = 0; j < 26; ++j)

      cin >> s[i][j];

  

  long long total(0);

  vector<int> options(n);

  

  for (int i = 0; i < n; ++i) {

    int neg(0), test(-1);

    for (int j = 0; j < 26; ++j) {

      neg -= c[j] * (i - last[j]);

    }

    

    int max_score = -1e9;

    for (int j = 0; j < 26; ++j) {

      int ss = s[i][j] + neg + c[j] * (i - last[j]);

      if (ss > max_score) {

        max_score = ss;

        test = j;

      }

    }

    total += max_score;

    options[i] = test;

    last[test] = i;

  }

  /* reversed: 109149564 */

  /* sorted: */

  /* stocahstic */

  for (int t = 1; t <= 500; ++t) {

    bool entered = false;

    for (int dd = 0; dd < n; ++dd) {

      for (int tt = 0; tt < 26; ++tt) {

        if (tt == options[dd]) continue;

        int ot = options[dd];

        long long ns = calc(n, c[tt], c[ot], s[dd][tt], s[dd][ot],

                            options, dd, tt, ot);

        //cout << ns << endl;

        if (ns > 0) {

          entered = true;

          total += ns;

          options[dd] = tt;

    	}

      }

    }

    if (!entered) break;

  }

  for (const int& i: options) cout << i + 1 << endl;

  

  return 0;

}

// Fastest known solution for this problem: