n = int(input())
results = []
for i in range(n):
results.append(list(map(int, input().split())))
for r in results:
if r[0] != r[1]:
print("rated")
exit()
for i in range(n):
for j in range(i):
if results[i][0] > results[j][0]:
print("unrated")
exit()
print("maybe")
#include <bits/stdc++.h>
using namespace std;
int main() {
int p, x, y;
cin >> p >> x >> y;
for (int s = y; ; s++) {
if (s % 50 != x % 50) {
continue;
}
bool me = false;
int i = s / 50 % 475;
for (int j = 0; j < 25; j++) {
i = (i * 96 + 42) % 475;
if (i + 26 == p) {
me = true;
break;
}
}
if (me) {
printf("%d\n", (max(0, s - x) + 50) / 100);
break;
}
}
return 0;
}
p, x, y = map(int, input().split())
def check(s):
i = (s // 50) % 475
for t in range(25):
i = (i * 96 + 42) % 475
if 26 + i == p:
return True
return False
for up in range(500):
for down in range(500):
if x + 100 * up - 50 * down >= y and check(x + 100 * up - 50 * down):
print(up)
exit()
assert(False)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool check(ll x, ll y, ll p, ll q, ll t) {
return p * t >= x && q * t - p * t >= y - x;
}
void solve() {
ll x, y, p, q;
scanf("%lld%lld%lld%lld", &x, &y, &p, &q);
ll l = -1;
ll r = (ll) 1e9;
if (!check(x, y, p, q, r)) {
printf("-1\n");
return;
}
while (r - l > 1) {
ll m = (l + r) / 2;
if (check(x, y, p, q, m)) {
r = m;
} else {
l = m;
}
}
printf("%lld\n", r * q - y);
}
int main() {
int t;
scanf("%d", &t);
while (t--) {
solve();
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main() {
int tt;
cin >> tt;
while (tt--) {
int x, y, p, q;
cin >> x >> y >> p >> q;
if (p == 0) {
cout << (x == 0 ? 0 : -1) << endl;
continue;
}
if (p == q) {
cout << (x == y ? 0 : -1) << endl;
continue;
}
int t1 = (x + p - 1) / p;
int t2 = ((y - x) + (q - p) - 1) / (q - p);
cout << (q * 1LL * max(t1, t2) - y) << endl;
}
return 0;
}
include <bits/stdc++.h>
using namespace std;
const int N = 123456; const int m = 5; const int k = 6;
int a[N][m]; int score[N]; int cost[m]; int solved[m];
int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { scanf("%d", a[i] + j); if (a[i][j] != -1) { solved[j]++; } } } for (int bots = 0; bots <= ((1 << k) — 1) * n; bots++) { for (int j = 0; j < m; j++) { int total = n + bots; int cur = solved[j]; if (a[0][j] != -1 && a[1][j] != -1 && a[0][j] > a[1][j]) { cur += bots; } cost[j] = 500; while (cost[j] < 500 * k && 2 * cur <= total) { cur *= 2; cost[j] += 500; } } for (int i = 0; i < 2; i++) { score[i] = 0; for (int j = 0; j < m; j++) { if (a[i][j] != -1) { score[i] += cost[j] / 250 * (250 — a[i][j]); } } } if (score[0] > score[1]) { printf("%d\n", bots); return 0; } } printf("%d\n", -1); return 0; }