use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [usize; n]
    };

    let a: Vec<usize> = a;

    for i in 0..n {
        let mut x = a.clone();
        x[i] = 0;
        println!("{}", x.iter().max().unwrap());
    }
}
