read N
ma=0
mb=0
mai=0
mbi=0
i=0
for b in `dd`;do
	if [ $ma -lt $b ];then
		mb=$ma
		mbi=$mai
		ma=$b
		mai=$i
	elif [ $mb -lt $b ];then
		mb=$b
		mbi=$i
	fi
	i=$[i+1]
done
for i in `seq 0 $[mai-1]`;do
	echo $ma
done
echo $mb
for i in `seq $[mai+1] $[N-1]`;do
	echo $ma
done