use std::io::Read;
use rand::prelude::*;

pub fn get_time() -> f64 {
    static mut STIME: f64 = -1.0;
    let t = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap();
    let ms = t.as_secs() as f64 + t.subsec_nanos() as f64 * 1e-9;
    unsafe {
        if STIME < 0.0 {
            STIME = ms;
        }
        ms - STIME
    }
}

#[allow(non_snake_case)]
struct Input {
    D: usize,          // Days
    s: Vec<Vec<i64>>,  // score(day, contest)
    c: Vec<i64>        // cost(contest)
}

fn compute_score(input: &Input, out: &Vec<usize>) -> i64 {
    let mut score = 0;
    let mut last = vec![0; 26];
    for d in 0..out.len() {
        score += input.s[d][out[d]];
        last[out[d]] = d + 1;
        for i in 0..26 {
            score -= input.c[i] * (d + 1 - last[i]) as i64;
        }
    }
    score
}

#[allow(dead_code)]
fn solve_debug(input: &Input) -> Vec<usize> {
    let out = vec![0; input.D];
    out
}

#[allow(dead_code)]
fn evaluate(input: &Input, out: &Vec<usize>, k: usize) -> i64 {
    let mut score = 0;
    let mut last = vec![0; 26];
    for d in 0..out.len() {
        score += input.s[d][out[d]];
        last[out[d]] = d + 1;
        for i in 0..26 {
            score -= input.c[i] * (d + 1 - last[i]) as i64;
        }
    }
    for d in out.len()..(out.len() + k).min(input.D) {
        for i in 0..26 {
            score -= (d + 1 - last[i]) as i64 * input.c[i];
        }
    }
    score
}

#[allow(dead_code)]
fn solve_greedy_k(input: &Input, k: usize) -> Vec<usize> {
    let mut out = vec![];
    for _ in 0..input.D {
        let mut max_score = i64::min_value();
        let mut best_i = 0;
        for i in 0..26 {
            out.push(i);
            let score = evaluate(&input, &out, k);
            if max_score < score {
                max_score = score;
                best_i = i;
            }
            out.pop();
        }
        out.push(best_i);
    }
    out
}

#[allow(dead_code)]
fn solve_greedy(input: &Input) -> Vec<usize> {
    let mut score = i64::min_value();
    let mut out = vec![];
    for k in 0..=26 {
        let out_tmp = solve_greedy_k(&input, k);
        let score_tmp = compute_score(&input, &out_tmp);
        if score_tmp > score {
            score = score_tmp;
            out = out_tmp;
        }
    }
    out
}

#[allow(dead_code)]
fn solve_local(input: &Input) -> Vec<usize> {
    const TL: f64 = 1.9;
    let mut rng = rand_pcg::Pcg64Mcg::new(890482);
    let mut out: Vec<usize> = (0..input.D).map(|_| rng.gen_range(0, 26)).collect();
    let mut score = compute_score(&input, &out);

    while get_time() < TL {
        if rng.gen_bool(0.5) {
            let d = rng.gen_range(0, input.D);
            let q = rng.gen_range(0, 26);
            let old = out[d];
            out[d] = q;
            let new_score = compute_score(&input, &out);
            if score > new_score {
                out[d] = old;
            } else {
                score = new_score;
            }
        } else {
            let d1 = rng.gen_range(0, input.D - 1);
            let d2 = rng.gen_range(d1 + 1, (d1 + 16).min(input.D));
            out.swap(d1, d2);
            let new_score = compute_score(&input, &out);
            if score > new_score {
                out.swap(d1, d2);
            } else {
                score = new_score;
            }
        }
    }
    out
}

#[allow(non_snake_case)]
fn main() {
    let mut buffer = String::new();
    std::io::stdin().read_to_string(&mut buffer).unwrap();
    let mut iter = buffer.split_whitespace();

    let D: usize = iter.next().unwrap().parse().unwrap();
    let c: Vec<i64> = (0..26)
        .map(|_| iter.next().unwrap().parse().unwrap()).collect();
    let s: Vec<Vec<i64>> = (0..D)
        .map(|_| (0..26)
            .map(|_| iter.next().unwrap().parse().unwrap()).collect()
        )
        .collect();
    let input = Input{ D, s, c };

    let out = solve_local(&input);

    for i in 0..D {
        println!("{}", out[i] + 1);
    }
}


Measured memory_bytes: 2304