my $max = 0;
my $count = 0;
my $n = 0;
my @A_n = ();

while (<STDIN>) {
    if ($count == 0){ 
        $n = $_;
        $count++;
        next; 
    }

    push(@A_n, $_);
}


for ($i=0; $i<$n; $i++) {
    my $max = 0;
    my $a_i = @A_n[$i];

    for ($j=0; $j<$n; $j++) {
        if ($i == $j) {
            next;
        }

        my $a_j = @A_n[$j];

        if ($a_j > $max) {
            $max = $a_j;
        }
    }

    print "$max";

    if ($i != $n -1 ){
        print "\n";
    }
}