use std::io;
use std::io::prelude::*;

fn main() {
    let mut s = String::new();
    let _ = io::stdin().read_to_string(&mut s).unwrap();
    let v: Vec<i32> = s.split('\n')
                       .filter(|x| !x.is_empty())
                       .map(|x| x.parse::<i32>().unwrap())
                       .collect();

    for i in 0..v[1..].len() {
        let mut max = 0;
        let mut idx = 0;
        for j in &v[1..] {
            if idx != i {
                let x = j.clone();
                if max < x {
                    max = x
                }
            }
            idx += 1
        }
        println!("{}", max);
    }
}
