Cast Scapeshift, sacrificing 10 lands and searching your library for Maze's End and nine gates minus the number of gates already on the battlefield under your control and putting them onto the battlefield untapped.
Tap the lands for mana.
Activate Maze's End, searching your library for a tenth gate and putting it onto the battlefield, winning you the game.