Cast Reshape the Earth, searching your library for nine gates minus the number of gates already on the battlefield under your control and putting them onto the battlefield.
Activate Maze's End, searching your library for a tenth gate and putting it onto the battlefield, winning you the game.