backup of hardest solutions
Upgraded version of Main3 -- handle cross case