Hide

Problem D
Efficiency

/problems/efficiency/file/statement/en/img-0001.png
Enchanted Pickaxes

Steve enjoys parties and word games. At one party, he challenges his friends to play a new word game that he invented.

In Steve’s game, there are four words: “Efficiency”, “Unbreaking”, “Silk”, and “Touch”.

There are $P$ players playing the game. At a given $N^{th}$ round, the players go around in circles, each saying the word “Efficiency” once per person, until the word has been said $N$ times. Then, starting with the next player (right after the last player to say “Efficiency”), they go around in the same fashion, each saying “Unbreaking” until it has been said $N$ times. Lastly, continuing with the next player, they go around saying “Silk” and “Touch” alternately until both words have been said $N$ times.

For instance, in a game of $3$ people, the sequence of words is as follows:

$1^{st}$ Player

$2^{nd}$ Player

$3^{rd}$ Player

Efficiency

Unbreaking

Silk (back to the $1^{st}$ player)

Touch

Efficiency

Efficiency

Unbreaking

Unbreaking

Silk

Touch

Silk

Touch

Efficiency

Efficiency

Efficiency

Unbreaking

Unbreaking

Unbreaking

Silk

Touch

Silk

Touch

Silk

Touch (end of $3^{rd}$ round)

Here, one can see that it takes $24$ turns (number of words said) to complete three rounds of the game. Moreover, Player $3$ goes last during the third round.

Steve checks in at the $M^{th}$ turn, telling his friends to wrap up the game and go for a walk in the soul sand valley. Which word is being said at the $M^{th}$ turn, and who will go last in this round?

Input

The first line contains one integer $P$ ($1 \leq P \leq 1\, 000$), the number of players in the game.
The second line contains one integer $M$ ($1 \leq M \leq 10^6$), which refers to the $M^{th}$ word that is said during the game.

Output

The output should consist of two lines. On the first line, output the $M^{th}$ word said during the game; it should be one of “Efficiency”, “Unbreaking”, “Silk”, or “Touch”. On the second line, output an integer representing the player who goes last during this round (players are numbered $1, 2, 3, \ldots $).

Sample Input 1 Sample Output 1
3
24
Touch
3
Sample Input 2 Sample Output 2
1
19
Silk
1

Please log in to submit a solution to this problem

Log in