#include using namespace std; typedef long long ll; typedef pair pii; #define pb push_back #define all(a) a.begin(), a.end() #define sz(a) ((int)a.size()) #ifdef Doludu template ostream& operator << (ostream &o, vector vec) { o << "{"; int f = 0; for (T i : vec) o << (f++ ? " " : "") << i; return o << "}"; } void bug__(int c, auto ...a) { cerr << "\e[1;" << c << "m"; (..., (cerr << a << " ")); cerr << "\e[0m" << endl; } #define bug_(c, x...) bug__(c, __LINE__, "[" + string(#x) + "]", x) #define bug(x...) bug_(32, x) #define bugv(x...) bug_(36, vector(x)) #define safe bug_(33, "safe") #else #define bug(x...) void(0) #define bugv(x...) void(0) #define safe void(0) #endif const int mod = 998244353, N = 100005; ll Pow(ll a, ll b, ll m) { a %= m; ll cur = 1; for (; b; b >>= 1, a = a * a % m) { if (b & 1) cur = cur * a % m; } return cur; } int main() { ios::sync_with_stdio(false), cin.tie(0); int t; cin >> t; while (t--) { ll a, b, d, r; cin >> a >> b >> d >> r; ll g = gcd(d, r); d /= g, r /= g; // b, a * r/(d+r) ll x = b * (d + r), y = a * r; if (x != y) { cout << (x < y ? "rabbit\n" : "turtle\n"); } else { ll rm = Pow(10, 100, d + r); if (rm == 0) { cout << "tie\n"; continue; } if (rm == 1) { cout << "rabbit\n"; continue; } ll cl = 0, cr = rm + 1; while (cr - cl > 1) { ll cm = cl + cr >> 1; ll cur = d * cm - r * (rm - cm); if (cur >= d) cr = cm; else cl = cm; } ll cur = d * cl - r * (rm - cl); bug(cur); if (cur == 0) { cout << "tie\n"; } else if (cur < 0) { cout << "turtle\n"; } else { cout << "rabbit\n"; } } } }