CF786A Berzerk

Description

Rick and Morty are playing their own version of Berzerk (which has nothing in common with the famous Berzerk game). This game needs a huge space, so they play it with a computer. In this game there are $ n $ objects numbered from $ 1 $ to $ n $ arranged in a circle (in clockwise order). Object number $ 1 $ is a black hole and the others are planets. There's a monster in one of the planet. Rick and Morty don't know on which one yet, only that he's not initially in the black hole, but Unity will inform them before the game starts. But for now, they want to be prepared for every possible scenario. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF786A/4581566160d89c6e337f9c80481a09310fbff76c.png)Each one of them has a set of numbers between $ 1 $ and $ n-1 $ (inclusive). Rick's set is $ s_{1} $ with $ k_{1} $ elements and Morty's is $ s_{2} $ with $ k_{2} $ elements. One of them goes first and the player changes alternatively. In each player's turn, he should choose an arbitrary number like $ x $ from his set and the monster will move to his $ x $ -th next object from its current position (clockwise). If after his move the monster gets to the black hole he wins. Your task is that for each of monster's initial positions and who plays first determine if the starter wins, loses, or the game will stuck in an infinite loop. In case when player can lose or make game infinity, it more profitable to choose infinity game.

Input Format

N/A

Output Format

N/A