<?php
# 入力
fscanf(STDIN, '%d', $n);
$a = [];
foreach(range(1, $n) as $i) {
    $a[] = intval(trim(fgets(STDIN)));
}
foreach($a as $i => $v) {
    $a_tmp = $a;
    unset($a_tmp[$i]);
    echo max($a_tmp).PHP_EOL;
}