my $n = <STDIN>;
my $counter1=0;my@a;my$number;
while ($n>$counter1){$number=<STDIN>;chomp($number);push(@a,$number);$counter1++;}
my$counter2=0;my @out;my @sorted;
while ($n>$counter2){@out =splice(@a,$counter2,1);@sorted=sort{ $b <=> $a } @a;print $sorted[0],"\n"; splice(@a,$counter2,0,@out);$counter2++;}