Rami and Yessine were learning some advanced data structures. Eventually, they got tired from writing code so they decided to take a break and play a game.
Rami told Yessine about a game of cards he has invented. In this game, each player will get $$$N$$$ cards. Each card has a number written on it and both players can see each other's cards.
They will take turns to play. At each turn, a player must choose a prime number $$$P,$$$ then, the other player must find a card in his hands with a number $$$C$$$ divisible by $$$P$$$, then change the number written on that paper to $$$\frac{C}{P}$$$. The chosen prime number $$$P$$$ should be less than or equal to $$$L$$$, where $$$L$$$ is a number they agree on before the game starts. The player who can't make a move loses.
Rami will start first. Assuming both players will play optimally, determine who will win at each game .
- Ths first line contains $$$2$$$ integers $$$1\leq N \leq 10^5$$$ and $$$2\leq L \leq 10^6$$$.
- The second line contains N space separated integers $$$1 \leq A_1,\dots,A_N \leq 10^6$$$ denoting the numbers written on Rami's cards
- The third line contains N space separated integers $$$1 \leq B_1,\dots,B_N \leq 10^6$$$ denoting the numbers written on Yessine's cards.
Rami if Rami will win. Otherwise Yessine if he will win.
3 3 6 3 4 1 2 3
Rami
5 7 2 3 4 5 6 2 3 5 7 2
Yessine