fn get_input() -> String {
    let mut word = String::new();
    std::io::stdin().read_line(&mut word).unwrap();
    word.trim().to_owned()
}

fn main() {
    let n: usize = get_input().parse().unwrap();
    let a:Vec<i64> = (0..n).map(|_| get_input().parse().unwrap()).collect();

    for i in 0..n {
        let mut ax:Vec<i64> = Vec::new();
        for j in 0..n {
            if i != j {
                ax.push(a[j]);
            }
        }
        println!("{}", ax.iter().max().unwrap());
    }
}
