Solution for The dating game.