Algorithm


C. Beaver Game
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Two beavers, Timur and Marsel, play the following game.

There are n logs, each of exactly m meters in length. The beavers move in turns. For each move a beaver chooses a log and gnaws it into some number (more than one) of equal parts, the length of each one is expressed by an integer and is no less than k meters. Each resulting part is also a log which can be gnawed in future by any beaver. The beaver that can't make a move loses. Thus, the other beaver wins.

Timur makes the first move. The players play in the optimal way. Determine the winner.

Input

The first line contains three integers nmk (1 ≤ n, m, k ≤ 109).

Output

Print "Timur", if Timur wins, or "Marsel", if Marsel wins. You should print everything without the quotes.

Examples
input
Copy
1 15 4
output
Copy
Timur
input
Copy
4 9 5
output
Copy
Marsel
Note

In the first sample the beavers only have one log, of 15 meters in length. Timur moves first. The only move he can do is to split the log into 3 parts each 5 meters in length. Then Marsel moves but he can't split any of the resulting logs, as k = 4. Thus, the winner is Timur.

In the second example the beavers have 4 logs 9 meters in length. Timur can't split any of them, so that the resulting parts possessed the length of not less than 5 meters, that's why he loses instantly.



 

Code Examples

#1 Code Example with C++ Programming

Code - C++ Programming

#include <cstdio>
#include <cmath>

int main(){

    long n, m, k; scanf("%ld %ld %ld\n", &n, &m, &k);
    if(n % 2 == 0){puts("Marsel"); return 0;}
    else{
        bool possible(0);
        for(long p = 1; p * p <= m; p++>{
            if(m % p > 0){continue;}
            if((k <= (m / p) && p > 1) || ((k <= p) && (m / p > 1)) ){possible = 1; break;}
        }

        puts(possible ? "Timur" : "Marsel");
    }

    return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
1 15 4

Output

x
+
cmd
Timur
Advertisements

Demonstration


Codeforces Solution-C. Beaver Game-Solution in C, C++, Java, Python

Previous
Codeforces solution 1080-B-B. Margarite and the best present codeforces solution
Next
CodeChef solution DETSCORE - Determine the Score CodeChef solution C,C+