implemented the winning problem