#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

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

fn main() {
    let d = read::<usize>();
    let c = read_vec::<i64>();
    let mut s = vec![vec![]; d];
    for i in 0..d {
        s[i] = read_vec::<i64>();
    }

    let mut answers = vec![];

    for i in 0..d {
        let mut max_idx = 0;
        for j in 0..26 {
            if s[i][j] > s[i][max_idx] {
                max_idx = j;
            }
        }
        answers.push(max_idx);
    }

    let mut assign = vec![0; 26];
    for i in 0..26 {
        assign[i] = c[i] as usize + 10;
    }

    let mut assigned = vec![0; assign.iter().sum::<usize>()];
    let mut cur_pointer = 0;
    for i in 0..26 {
        for _ in 0..assign[i] {
            assigned[cur_pointer] = i;
            cur_pointer += 1;
        }
    }

    let mut answers = vec![];

    for i in 0..d {
        let mut max_idx = 0;
        for j in 0..26 {
            if s[i][j] > s[i][max_idx] {
                max_idx = j;
            }
        }
        answers.push(max_idx);
    }
    search(&c, &mut answers, &s, &assigned);

    for ans in answers {
        println!("{}", ans + 1);
    }
}

fn search(c: &Vec<i64>, t: &mut Vec<usize>, s: &Vec<Vec<i64>>, assigned: &Vec<usize>) -> i64 {
    let d = t.len();
    let mut cur_score = calc_score(&c, &t, &s);
    let mut xor = Xorshift::new();
    let round_num = 390000 / d;
    // let round_num = 150;
    for ri in 0..2 {
        for rd in 0..d {
            for rq in 0..26 {
                let prev = t[rd];
                t[rd] = rq;

                let score = calc_score(&c, &t, &s);
                if score > cur_score {
                    cur_score = score;
                } else {
                    t[rd] = prev;
                }
            }
        }
    }

    for ri in 0..round_num {
        for rd in 0..d {
            // let rd = xor.next() as usize % d;
            let rq = assigned[xor.next() as usize % assigned.len()];
            let mut prev = t[rd];
            let mut swapped = false;
            if xor.randf() >= 0.5 {
                swapped = true;
                t[rd] = rq;
            } else {
                if rd == d - 1 {
                    break;
                }
                prev = t[rd];
                t[rd] = t[rd + 1];
                t[rd + 1] = prev;
            }

            let score = calc_score(&c, &t, &s);
            let temp =
                (round_num as f64 - ri as f64 - 1.0) / (round_num as f64 - 1.0) * 3000.0 + 10.0;
            let prob = ((score as f64 - cur_score as f64) / temp).exp();
            let j = xor.randf();
            // debug!(score as f64 - cur_score as f64, temp, prob, j);
            if score > cur_score || j <= prob {
                cur_score = score;
            } else {
                if swapped {
                    t[rd] = prev;
                } else {
                    prev = t[rd];
                    t[rd] = t[rd + 1];
                    t[rd + 1] = prev;
                }
            }
        }
    }

    for ri in 0..3 {
        for rd in 0..d {
            for rq in 0..26 {
                let prev = t[rd];
                t[rd] = rq;

                let score = calc_score(&c, &t, &s);
                if score > cur_score {
                    cur_score = score;
                } else {
                    t[rd] = prev;
                }
            }
        }
    }
    cur_score
}

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

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[derive(Debug)]
pub struct Xorshift {
    seed: u64,
}
impl Xorshift {
    pub fn new() -> Xorshift {
        Xorshift {
            seed: 0xf0fb588ca2196dac,
        }
    }
    pub fn with_seed(seed: u64) -> Xorshift {
        Xorshift { seed: seed }
    }
    #[inline]
    pub fn next(&mut self) -> u64 {
        self.seed = self.seed ^ (self.seed << 13);
        self.seed = self.seed ^ (self.seed >> 7);
        self.seed = self.seed ^ (self.seed << 17);
        self.seed
    }
    #[inline]
    pub fn rand(&mut self, m: u64) -> u64 {
        self.next() % m
    }

    pub fn randf(&mut self) -> f64 {
        use std::mem;
        const UPPER_MASK: u64 = 0x3FF0000000000000;
        const LOWER_MASK: u64 = 0xFFFFFFFFFFFFF;
        let tmp = UPPER_MASK | (self.next() & LOWER_MASK);
        let result: f64 = unsafe { mem::transmute(tmp) };
        result - 1.0
    }
}


Measured memory_bytes: 3288