<?php
$n = trim(fgets(STDIN));

$arr = [];
for ($i = 0; $i < $n; $i++) {
     $arr[$i] = trim(fgets(STDIN));
}

for ($i = 0; $i < $n; $i++) {
    $tmp = $arr;
    array_splice($tmp, $i, 1);
    echo max($tmp) . "\n";
}