use proconio::input;
use rand::Rng;
use std::i64;
use std::time::{Duration, Instant};
struct Evaluator {
    dd: usize,
    penalty: Vec<i64>,
    holding: Vec<Vec<i64>>,
    select: Vec<usize>,
    last: Vec<[usize; 26]>,
    score: Vec<i64>,
}
impl Evaluator {
    fn new(dd: usize, penalty: Vec<i64>, holding: Vec<Vec<i64>>, select: Vec<usize>) -> Evaluator {
        Evaluator {
            dd,
            penalty,
            holding,
            select,
            last: vec![Default::default(); dd],
            score: vec![0; dd],
        }
    }
    fn calc_last_all(&mut self) {
        for d in 0..self.dd {
            if d > 0 {
                self.last[d] = self.last[d - 1];
            }
            self.last[d][self.select[d]] = d + 1;
        }
    }
    fn update_last_after(&mut self, day: usize, old_contest: usize, new_contest: usize) {
        let old = if day == 0 {
            0
        } else {
            self.last[day - 1][old_contest]
        };
        assert_eq!(self.last[day][old_contest], day + 1);
        for d in day..self.dd {
            if self.last[d][old_contest] != day + 1 {
                break;
            }
            self.last[d][old_contest] = old;
        }
        let first_last = self.last[day][new_contest];
        for d in day..self.dd {
            if self.last[d][new_contest] != first_last {
                break;
            }
            self.last[d][new_contest] = day + 1;
        }
    }
    fn calc_all(&mut self) -> i64 {
        self.calc_last_all();
        self.calc_after(0)
    }
    fn calc_after(&mut self, from: usize) -> i64 {
        for d in from..self.dd {
            self.score[d] = 0;
            self.score[d] += self.holding[d][self.select[d]];
            #[allow(clippy::needless_range_loop)]
            for i in 0..26 {
                self.score[d] -= self.penalty[i] * (d + 1 - self.last[d][i]) as i64;
            }
        }
        self.score.iter().sum()
    }
    fn calc_before(&mut self, to: usize) -> i64 {
        for d in 0..=to {
            self.score[d] = 0;
            self.score[d] += self.holding[d][self.select[d]];
            #[allow(clippy::needless_range_loop)]
            for i in 0..26 {
                self.score[d] -= self.penalty[i] * (d + 1 - self.last[d][i]) as i64;
            }
        }
        self.score.iter().take(to).sum()
    }
    fn change_contest(&mut self, day: usize, contest: usize) -> i64 {
        self.update_last_after(day, self.select[day], contest);
        self.select[day] = contest;
        self.calc_after(day)
    }
}
fn main() {
    let timer = Instant::now();
    input! { dd : usize , c : [ i64 ; 26 ] , s : [ [ i64 ; 26 ] ; dd ] , }
    let mut select = Vec::new();
    let mut last = [0; 26];
    for d in 0..dd {
        let mut maxvalue = i64::MIN;
        let mut maxi = 0;
        for i in 0..26 {
            let mut value = 0;
            {
                let lastlast = last[i];
                last[i] = d + 1;
                value += s[d][i];
                #[allow(clippy::needless_range_loop)]
                for i in 0..26 {
                    value -= c[i] * (d + 1 - last[i]) as i64;
                }
                last[i] = lastlast;
            }
            if value > maxvalue {
                maxvalue = value;
                maxi = i;
            }
        }
        last[maxi] = d + 1;
        select.push(maxi);
    }
    let mut rng = rand::thread_rng();
    let mut eval = Evaluator::new(dd, c, s, select);
    let mut current_value = eval.calc_all();
    let before = current_value;
    while timer.elapsed() < Duration::from_millis(1900) {
        let day = rng.gen_range(0, dd);
        let contest = rng.gen_range(0, 25);
        let old_contest = eval.select[day];
        let changed_value = eval.change_contest(day, contest);
        if current_value > changed_value {
            eval.change_contest(day, old_contest);
        } else {
            current_value = changed_value;
        }
    }
    for contest in eval.select {
        println!("{}", contest + 1);
    }
}



Measured memory_bytes: 2832