#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::io::Read;
use std::io::{stdout, BufWriter, Write};
 
fn main() {
    let mut buf = String::new();
    
    let out = stdout();
    let mut out = BufWriter::new(out.lock());
 
    // 標準入力から全部bufに読み込む
    std::io::stdin().read_to_string(&mut buf).unwrap();
 
    // 読み込んだStringを空白で分解する
    let mut iter = buf.split_whitespace();
 
    
    let n: usize = iter.next().unwrap().parse().unwrap();
    
    let a : Vec<i64> = (0..n).map(|_|{
        iter.next().unwrap().parse().unwrap()
    }).collect();
    
    for i in 0..n {
        let mut max = 1;
        for j in 0..n {
            if i == j {continue;}
            if a[j] > max {max = a[j];}
        }
        println!("{}",max);
    }
    
    //println!("{:?}", a);
    
}