use whiteread::parse_line;

fn main() {
    let n: usize = parse_line().unwrap();
    let mut a: Vec<u32> = Vec::new();
    for _ in 0..n {
        a.push(parse_line().unwrap());
    }
    for i in 0..n {
        let num = a.remove(i);
        println!("{}", a.iter().max().unwrap());
        a.insert(i, num);
    }
}
