use strict;
use warnings;
use utf8;

my @variables = ();

while(<STDIN>){
    chomp($_);
    push(@variables, $_)
}

my $N = $variables[0];
shift(@variables);

my @a = ();
my @b = ();
my @c = ();

for(my $i=0; $i<$N; $i++){
    if($i==0){
        @c = @variables[1..$N-1];
    }
    elsif($i==$N-1){
        @c = @variables[0..$N-2];
    }
    else{
        @a = @variables[0..$i-1];
        @b = @variables[$i+1..$N-1];
        @c = (@a, @b);
    }

    @c = sort {$b <=> $a} @c;

    print ($c[0]);
}
