<?php
while ($line = fgets(STDIN)) {
    $tmp[] = trim($line);
}

array_splice($tmp, 0, 1);

foreach ($tmp as $key => $value) {
    $array = $tmp;

    array_splice($array, $key, 1);

    $result = max($array);
    echo $result . "\n";
}
