use std::io;
use std::str::FromStr;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn input_vec() -> Vec<i64> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.split_whitespace().map(|s| s.parse().unwrap()).collect()
}

fn calc(contest: usize, day_idx: i64, last: &Vec<i64>, c_vec: &Vec<i64>, scores: &Vec<Vec<i64>>) -> i64 {
    let mut score = scores[day_idx as usize][contest];
    for i in 0..26 {
        if i == contest {
            continue;
        }
        score -= c_vec[i] * (day_idx + 1 - last[i]);
    }
    score
}

fn simulate(day_idx: i64, last: &Vec<i64>, c_vec: &Vec<i64>, scores: &Vec<Vec<i64>>) -> usize {
    let mut max = std::i64::MIN;
    let mut max_indices = vec![0; 3];
    for contest1 in 0..26 {
        for contest2 in 0..26 {
            // for contest3 in 0..26 {
                let mut last_buf = last.to_vec();
                let mut sum = 0;
                sum += calc(contest1, day_idx, &last_buf, c_vec, scores);
                last_buf[contest1] = day_idx;
                if day_idx + 1 < scores.len() as i64 {
                    sum += calc(contest2, day_idx + 1, &last_buf, c_vec, scores);
                    last_buf[contest2] = day_idx + 1;
                }
                // if day_idx + 2 < scores.len() as i64 {
                //     sum += calc(contest3, day_idx + 2, &last_buf, c_vec, scores);
                //     last_buf[contest3] = day_idx + 2;
                // }
                if sum > max {
                    max = sum;
                    max_indices[0] = contest1;
                    max_indices[1] = contest2;
                    // max_indices[2] = contest3;
                }
            // }
        }
    }
    max_indices[0]
    // max
}

fn greedy(d: i64, c_vec: &Vec<i64>, scores: &Vec<Vec<i64>>) -> Vec<usize> {
    let mut last = vec![0; 26];
    let mut schedule: Vec<usize> = Vec::new();

    for day_idx in 0..d {
        let target = simulate(day_idx, &last, c_vec, scores);
        last[target] = day_idx + 1;
        schedule.push(target);
    }
    schedule
}

fn balanced(d: i64, c_vec: &Vec<i64>, scores: &Vec<Vec<i64>>) -> Vec<usize> {
    let mut total = 0;
    let mut last = vec![0; 26];
    let mut schedule: Vec<usize> = Vec::new();
    for day_idx in 0..d {
        let mut max = std::i64::MIN;
        let mut max_idx = 0;
        for contest_idx in 0..26 {
            let mut score = 0;
            for i in 0..26 {
                if i == contest_idx {
                    continue;
                }
                score -= c_vec[i] * (day_idx + 1 - last[i]);
            }
            if score > max {
                max = score;
                max_idx = contest_idx;
            }
        }
        total += max + scores[day_idx as usize][max_idx];
        last[max_idx] = day_idx + 1;
        schedule.push(max_idx);
    }
    println!("{}", total);
    schedule
}

fn main() {
    let d: i64 = input();
    let c_vec = input_vec();
    let mut scores: Vec<Vec<i64>> = Vec::new();
    for _ in 0..d {
        let score = input_vec();
        scores.push(score);
    }
    for i in greedy(d, &c_vec, &scores) {
        println!("{}", i + 1);
    }
}


Measured memory_bytes: 2276