Is it rated?

Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.

Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and after the round is known.

It's known that if at least one participant's rating has changed, then the round was rated for sure.

It's also known that if the round was rated and a participant with lower rating took a better place in the standings than a participant with higher rating, then at least one round participant's rating has changed.

In this problem, you should not make any other assumptions about the rating system.

Determine if the current round is rated, unrated, or it's impossible to determine whether it is rated of not.


-----Input-----

The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of round participants.

Each of the next n lines contains two integers a_{i} and b_{i} (1 ≤ a_{i}, b_{i} ≤ 4126) — the rating of the i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the standings.


-----Output-----

If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".


-----Examples-----
Input
6
3060 3060
2194 2194
2876 2903
2624 2624
3007 2991
2884 2884

Output
rated

Input
4
1500 1500
1300 1300
1200 1200
1400 1400

Output
unrated

Input
5
3123 3123
2777 2777
2246 2246
2246 2246
1699 1699

Output
maybe



-----Note-----

In the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.

In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, someone's rating would've changed for sure.

In the third example, no one's rating has changed, and the participants took places in non-increasing order of their rating. Therefore, it's impossible to determine whether the round is rated or not.

Source: codeforces | Difficulty: EASY
Tags: Sorting

Implementation


Solutions:
n = int(input())
l1 = []
l2 = []
for i in range(n):
	(a, b) = map(int, input().split())
	l1.append(a)
	l2.append(b)
rc = False
for i in range(n):
	if l1[i] != l2[i]:
		rc = True
		break
if rc == True:
	print('rated')
	return
tot = 0
for i in range(1, n):
	if l2[i] <= l2[i - 1]:
		tot += 1
if tot == n - 1:
	print('maybe')
	return
print('unrated')


k = int(input())
flag1 = 0
flag2 = 0
xrr = []
yrr = []
for i in range(k):
	(x, y) = map(int, input().split())
	xrr.append(x)
	yrr.append(y)
	if xrr[i] != yrr[i]:
		flag1 = 1
xr = xrr.copy()
yr = yrr.copy()
xr = sorted(xr, reverse=True)
if xr == xrr:
	flag2 = 1
if flag1 == 1:
	print('rated')
elif flag2 == 1:
	print('maybe')
else:
	print('unrated')


cases = int(input())
arr = []
while cases:
	cases -= 1
	(a, b) = map(int, input().split())
	if a != b:
		print('rated')
		exit()
	arr.append(a)
sor = sorted(arr, reverse=True)
if arr == sor:
	print('maybe')
else:
	print('unrated')


n = int(input())
(a, b) = ([], [])
for i in range(n):
	(x, y) = input().split()
	a.append(int(x))
	b.append(int(y))

def rate(a, b, n):
	for i in range(n):
		if a[i] != b[i]:
			return 'rated'
	if a[::-1] == sorted(a):
		return 'maybe'
	return 'unrated'
print(rate(a, b, n))


n = int(input())
rat = []
flag = 0
for i in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		flag = 1
	rat.append(a)

def issorted(rat):
	return all((rat[i] <= rat[i + 1] for i in range(0, n - 1)))

def issorted1(rat):
	return all((rat[i] >= rat[i + 1] for i in range(0, n - 1)))
if flag:
	print('rated')
elif issorted1(rat):
	print('maybe')
else:
	print('unrated')


n = int(input())
flag = 0
z = 0
x = 0
for i in range(n):
	(a, b) = map(int, input().split())
	if i == 0:
		z = a
	elif z < a:
		flag = 1
		z = a
	else:
		z = a
	if a != b:
		print('rated')
		exit(0)
if flag == 1:
	print('unrated')
else:
	print('maybe')


import math, string, itertools, collections, re, fractions, array, copy
import bisect
import heapq
from itertools import chain, dropwhile, permutations, combinations
from collections import deque, defaultdict, OrderedDict, namedtuple, Counter, ChainMap

def VI():
	return list(map(int, input().split()))

def I():
	return int(input())

def LIST(n, m=None):
	return [0] * n if m is None else [[0] * m for i in range(n)]

def ELIST(n):
	return [[] for i in range(n)]

def MI(n=None, m=None):
	if n is None:
		(n, m) = VI()
	arr = LIST(n)
	for i in range(n):
		arr[i] = VI()
	return arr

def MS(n=None, m=None):
	if n is None:
		(n, m) = VI()
	arr = LIST(n)
	for i in range(n):
		arr[i] = input()
	return arr

def MIT(n=None, m=None):
	if n is None:
		(n, m) = VI()
	a = MI(n, m)
	arr = LIST(m, n)
	for (i, l) in enumerate(a):
		for (j, x) in enumerate(l):
			arr[j][i] = x
	return arr

def main(info=0):
	n = I()
	m = MI(n, 2)
	for (a, b) in m:
		if a != b:
			print('rated')
			return
	for i in range(1, n):
		if m[i][0] > m[i - 1][0]:
			print('unrated')
			return
	print('maybe')
main()


def solve():
	l = []
	n = int(input())
	maybe = 0
	(a, b) = map(int, input().split())
	if abs(a - b) > 0:
		print('rated')
		return
	l.append((a, b))
	for i in range(1, n):
		(a, b) = map(int, input().split())
		l.append((a, b))
		if abs(a - b) > 0:
			print('rated')
			return
		if l[i - 1][0] < l[i][0]:
			maybe = 1
	if not maybe:
		print('maybe')
	else:
		print('unrated')
solve()


ncont = int(input())
scores = []
changed = 0
for i in range(ncont):
	n = input().split(' ')
	before = int(n[0])
	after = int(n[1])
	scores.append(after)
	if before != after:
		changed = 1
if changed == 1:
	print('rated')
else:
	for i in range(len(scores) - 1):
		ele1 = scores[i]
		ele2 = scores[i + 1]
		if ele1 < ele2:
			print('unrated')
			break
		elif i == len(scores) - 2:
			print('maybe')


n = int(input())
flag = 0
c = []
d = []
for i in range(n):
	(a, b) = map(int, input().split())
	c.append(a)
	d.append(b)
	if a != b:
		flag = 1
if flag == 1:
	print('rated')
elif flag == 0 and c[::-1] == sorted(c) and (d[::-1] == sorted(d)):
	print('maybe')
else:
	print('unrated')


n = int(input())
a = []
r = 0
u = 0
for i in range(n):
	(x, y) = map(int, input().split())
	if x != y:
		r = 1
	a.append((x, y))
for i in range(n - 1):
	if a[i][0] < a[i + 1][0]:
		u = 1
		break
if r:
	print('rated')
elif u:
	print('unrated')
else:
	print('maybe')


import math
import re
import random
n = int(input())
a = []
b = []
for i in range(n):
	(x, y) = map(int, input().split())
	a.append(x)
	b.append(y)
if a == b and a == sorted(a, reverse=True):
	print('maybe')
elif a == b and a != sorted(a, reverse=True):
	print('unrated')
else:
	print('rated')


ls = []
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ls.append((a, b))
l = ls[:]
ls.sort(reverse=True)
f = 0
for (i, j) in ls:
	if i != j:
		print('rated')
		f = 1
		break
if f == 0:
	if l == ls:
		print('maybe')
	else:
		print('unrated')


def rate():
	a = []
	noTests = int(input())
	for i in range(noTests):
		(ai, bi) = map(int, input().strip().split())
		if ai != bi:
			return 'rated'
		a.append(ai)
	if a == sorted(a, reverse=True):
		return 'maybe'
	return 'unrated'
print(rate())


temp = 0
l = []
flag = False
flagx = True
temp = 0
count = 0
n = int(input())
nx = n
(x, y) = map(int, input().strip().split())
if x - y != 0:
	flag = True
temp = x
while n != 1:
	(x, y) = map(int, input().strip().split())
	if x - y != 0:
		flag = True
	if x <= temp:
		count += 1
	temp = x
	n -= 1
if count == nx - 1:
	flagx = False
if flag == True:
	print('rated')
elif flag == False and flagx == True:
	print('unrated')
else:
	print('maybe')


def Main():
	n = int(input())
	A = []
	flag = False
	for _ in range(n):
		(a, b) = map(int, input().split())
		A.append(a)
		if a > b or a < b:
			flag = True
	if flag == True:
		print('rated')
		return 0
	f = False
	for i in range(len(A) - 1):
		if A[i] >= A[i + 1]:
			f = True
		else:
			f = False
			break
	if f:
		print('maybe')
	else:
		print('unrated')
Main()


N = int(input())
ratings = [tuple((int(x) for x in input().split())) for _ in range(N)]
if any((a != b for (a, b) in ratings)):
	print('rated')
elif sorted(ratings, reverse=True) == ratings:
	print('maybe')
else:
	print('unrated')


n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
if any((a[i][0] != a[i][1] for i in range(n))):
	print('rated')
elif a == list(reversed(sorted(a))):
	print('maybe')
else:
	print('unrated')


n = int(input())
ans = 0
pre = 0
count = 0
for i in range(n):
	(a, b) = map(int, input().split())
	if pre and pre >= b:
		count += 1
	pre = b
	if not a == b:
		ans = 1
		break
if ans == 1:
	print('rated')
elif count + 1 == n:
	print('maybe')
else:
	print('unrated')


n = int(input())
finalarray = []
finalarray1 = []
rating = False
temp = True
for i in range(n):
	temp_var = input()
	temp_var = temp_var.split()
	finalarray.append(int(temp_var[0]))
	finalarray1.append(int(temp_var[1]))
	if finalarray[i] != finalarray1[i]:
		rating = True
for i in range(1, len(finalarray)):
	if finalarray[i] > finalarray[i - 1] or finalarray1[i] > finalarray1[i - 1]:
		temp = False
		break
if rating == True:
	print('rated')
elif temp == False and rating == False:
	print('unrated')
else:
	print('maybe')


n = int(input())
l1 = []
l2 = []
for x in range(n):
	z = False
	(a, b) = map(int, input().strip().split()[:2])
	if a != b:
		print('rated')
		z = True
		break
	else:
		l1.append(a)
		l2.append(b)
if z != True:
	k = l1[:]
	k.sort()
	k.reverse()
	if k == l1:
		print('maybe')
	else:
		print('unrated')


import sys
input_ = sys.stdin.readline

def is_ordered(arr):
	for i in range(len(arr) - 1):
		if arr[i] < arr[i + 1]:
			return False
	else:
		return True

def main():
	n = int(input_())
	changed = False
	befores = []
	afters = []
	for x in range(n):
		(before, after) = list(map(int, input_().split()))
		if before != after:
			changed = True
		befores.append(before)
		afters.append(after)
	if changed:
		return 'rated'
	if is_ordered(afters):
		return 'maybe'
	return 'unrated'

def __starting_point():
	print(main())
__starting_point()


v = []
z = 0
for i in range(int(input())):
	(a, b) = map(int, input().split())
	v.append(a)
	if a - b != 0:
		z = 1
		break
b = v.copy()
if z == 1:
	print('rated')
else:
	b.sort(reverse=True)
	if b == v:
		print('maybe')
	else:
		print('unrated')


import sys

def main():
	n = int(sys.stdin.readline().rstrip())
	result = None
	aprevmax = None
	monotone = True
	for i in range(n):
		(ai, bi) = list(map(int, sys.stdin.readline().split()))
		if ai != bi:
			result = 'rated'
			break
		if aprevmax is not None:
			if ai > aprevmax:
				monotone = False
		aprevmax = ai
	if result is None:
		if monotone:
			result = 'maybe'
		else:
			result = 'unrated'
	sys.stdout.write(result + '\n')
main()


a = int(input())
b = []
r = 0
ur = 0
m = 0
j = []
for i in range(a):
	(c, d) = map(int, input().split())
	b.append(c)
	if c != d:
		r += 1
j = sorted(b, reverse=True)
if r >= 1:
	print('rated')
elif b != j:
	print('unrated')
else:
	print('maybe')


import math
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def invr():
	return list(map(int, input().split()))
n = inp()
(a, b) = ([], [])
for i in range(n):
	(ai, bi) = invr()
	a.append(ai)
	b.append(bi)
if a != b:
	print('rated')
elif a == list(sorted(a, reverse=True)):
	print('maybe')
else:
	print('unrated')


n = int(input())
ans = 'maybe'
rate = [0] * n
for i in range(n):
	(a, b) = map(int, input().split())
	rate[i] = [a, b]
	if a != b:
		ans = 'rated'
if ans == 'rated':
	print(ans)
else:
	mn = 10 ** 9
	for i in range(n):
		if mn < rate[i][0]:
			ans = 'unrated'
			break
		mn = min(mn, rate[i][0])
	print(ans)


import math

def solve():
	n = int(input())
	a = [0 for i in range(n)]
	b = [0 for i in range(n)]
	change = 0
	better = 0
	for i in range(n):
		(a[i], b[i]) = list((int(x) for x in input().split()))
		if a[i] != b[i]:
			change = 1
		for j in range(i):
			if a[j] < a[i]:
				better = 1
	if change:
		print('rated')
	elif better:
		print('unrated')
	else:
		print('maybe')

def main():
	solve()
	exit(0)
main()


n = int(input())
r = []
f = 0
for i in range(n):
	(a, b) = map(int, input().split())
	r.append([a, b])
	if a != b:
		f = 1
if f == 1:
	print('rated')
else:
	R = sorted(r)[::-1]
	if r == R:
		print('maybe')
	else:
		print('unrated')


n = int(input())
state = 'maybe'
l = []
for i in range(n):
	(x, y) = map(int, input().split())
	l.append(x)
	if x != y:
		state = 'rated'
		break
if state == 'maybe':
	if l[::-1] != sorted(l):
		state = 'unrated'
print(state)


n = int(input())
R = []
for i in range(n):
	(a, b) = map(int, input().split())
	R.append(a)
	if b != a:
		print('rated')
		break
else:
	B = sorted(R)
	R.reverse()
	if R == B:
		print('maybe')
	else:
		print('unrated')


n = int(input())
a = [0] * n
b = [0] * n
rated = False
for i in range(n):
	(a[i], b[i]) = [int(x) for x in input().split()]
	if a[i] != b[i]:
		rated = True
if rated:
	print('rated')
else:
	maybe = True
	for i in range(n - 1):
		if a[i] < a[i + 1]:
			maybe = False
			break
	print('unrated' if not maybe else 'maybe')


n = int(input())
nochange = True
order_kept = True
prev_b = float('inf')
for i in range(n):
	(b, a) = map(int, input().split())
	if b != a:
		nochange = False
		break
	if b > prev_b:
		order_kept = False
	prev_b = b
if not nochange:
	print('rated')
elif order_kept:
	print('maybe')
else:
	print('unrated')


n = int(input())
l1 = []
f = 0
for i in range(n):
	(a1, a2) = [int(x) for x in input().split()]
	if a1 != a2:
		f = 1
	l1.append(a1)
if f == 1:
	print('rated')
elif l1 == sorted(l1)[::-1]:
	print('maybe')
else:
	print('unrated')


x = int(input())
a = [list(map(int, input().split())) for i in range(x)]
k = 0
for i in range(x):
	if a[i][0] == a[i][1]:
		continue
	else:
		print('rated')
		k = 1
		break
if k == 0:
	t = []
	for i in range(x):
		t.append(a[i])
	if k == 0:
		a.sort(reverse=True)
		if t == a:
			print('maybe')
		else:
			print('unrated')


n = int(input())
l = []
for i in range(n):
	(a, b) = (int(i) for i in input().split())
	l.append(a)
	if a != b:
		print('rated')
		exit(0)
if l == list(sorted(l, reverse=True)):
	print('maybe')
else:
	print('unrated')


(n, r, u, p) = (int(input()), 0, 0, int(9999))
rating = [input().split() for _ in range(n)]
for i in range(n):
	if rating[i][0] != rating[i][1]:
		r = 1
		print('rated')
		exit()
	elif int(rating[i][0]) > p:
		u = 1
	p = int(rating[i][0])
if u:
	print('unrated')
else:
	print('maybe')


n = int(input())
a = []
b = []
for i in range(n):
	(a1, b1) = map(int, input().split())
	a.append(a1)
	b.append(b1)
for i in range(n):
	if a[i] != b[i]:
		print('rated')
		break
else:
	if b == sorted(a, reverse=True):
		print('maybe')
	else:
		print('unrated')


a = int(input())
w = []
for k in range(a):
	s = [int(j) for j in input().split()]
	if s[0] != s[1]:
		break
	else:
		w.append(s)
if len(w) != a:
	print('rated')
else:
	for k in range(a - 1):
		if w[k][1] < w[k + 1][1]:
			t = 'unrated'
			break
	else:
		t = 'maybe'
	print(t)


n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
r = 0
for i in range(n):
	if a[i][0] != a[i][1]:
		r = 1
		break
for i in range(n - 1):
	if r == 0:
		for j in range(i, n):
			if a[i][0] < a[j][0]:
				r = -1
				break
if r == 1:
	print('rated')
elif r == 0:
	print('maybe')
else:
	print('unrated')


from collections import deque
s1 = list()
s2 = list()
n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	s1.append(x)
	s2.append(y)
if s1 != s2:
	print('rated')
elif sorted(s1, reverse=True) != s1:
	print('unrated')
else:
	print('maybe')


n = int(input())
l = []
for i in range(n):
	l.append(list(map(int, input().split())))
if any((abs(l[i][0] - l[i][1]) for i in range(n))):
	print('rated')
elif all((l[i][0] >= l[i + 1][0] for i in range(n - 1))):
	print('maybe')
else:
	print('unrated')


n = int(input())
a = [0] * n
b = [0] * n
s = 0
s2 = 1
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
	s += abs(b[i] - a[i])
	if i > 0 and a[i - 1] < a[i]:
		s2 = 0
if s > 0:
	print('rated')
elif s2:
	print('maybe')
else:
	print('unrated')


n = int(input())
a = []
b = []
for i in range(n):
	(ai, bi) = map(int, input().split())
	a.append(ai)
	b.append(bi)
if a != b:
	print('rated')
else:
	k = a * 1
	k.sort(reverse=True)
	if a == k:
		print('maybe')
	else:
		print('unrated')


n = input()
list_2 = []
for i in range(int(n)):
	(a, b) = map(int, input().split())
	list_2.append(a)
	if a != b:
		print('rated')
		exit()
b = list(reversed(list_2))
if sorted(list_2) == b:
	print('maybe')
	exit()
print('unrated')


def rating(a, b):
	for i in range(len(a)):
		if a[i] != b[i]:
			return 'rated'
	if all((a[i] >= a[i + 1] for i in range(len(a) - 1))) and all((b[i] >= b[i + 1] for i in range(len(b) - 1))):
		return 'maybe'
	return 'unrated'
n = int(input())
lst1 = list()
lst2 = list()
for i in range(n):
	s = [int(i) for i in input().split()]
	lst1.append(s[0])
	lst2.append(s[1])
print(rating(lst1, lst2))


n = int(input())
m = []
flag = False
for i in range(n):
	m.append([int(i) for i in input().split()])
	if m[i][0] != m[i][1]:
		print('rated')
		exit()
	elif i > 0 and m[i][0] > m[i - 1][0]:
		flag = True
if flag:
	print('unrated')
else:
	print('maybe')


A = []
changed = False
for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a != b:
		changed = True
	A += [a]
if changed == True:
	print('rated')
else:
	s = A[::-1] == sorted(A)
	if not s:
		print('unrated')
	else:
		print('maybe')


n = int(input())
d = list(range(n))
u = True
e = True
for i in range(n):
	(a, b) = map(int, list(input().split()))
	if a != b:
		print('rated')
		e = False
		break
	d[i] = a
if e:
	for i in range(n):
		if i > 0:
			if d[i] > d[i - 1]:
				print('unrated')
				u = False
				break
	if u:
		print('maybe')


def rated(arr):
	for (i, j) in arr:
		if i != j:
			return 'rated'
	if sorted(arr) == arr[::-1]:
		return 'maybe'
	return 'unrated'
n = int(input())
arr = []
for i in range(n):
	tmp = list(map(int, input().split()))
	arr.append(tmp)
print(rated(arr))


aw = []
bw = []
for i in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	aw.append(a)
	bw.append(b)
w = list(aw)
w.sort(reverse=True)
if aw == bw and aw == w:
	print('maybe')
elif aw != bw:
	print('rated')
else:
	print('unrated')


def G1():
	round = int(input())
	scores = []
	for _ in range(round):
		a = [int(x) for x in input().split()]
		scores.append(a)
	flag = False
	for i in scores:
		if i[0] != i[1]:
			print('rated')
			flag = True
			break
	while not flag:
		for i in range(len(scores) - 1):
			if scores[i] >= scores[i + 1]:
				continue
			else:
				print('unrated')
				flag = True
				break
		if flag == False:
			print('maybe')
			break
G1()


from math import inf

def solve():
	unrated = False
	for i in range(n):
		if rates[i][0] != rates[i][1]:
			return 'rated'
		if i - 1 >= 0 and rates[i - 1] < rates[i]:
			unrated = True
	return 'unrated' if unrated else 'maybe'

def main():
	global rates, n
	n = int(input())
	rates = [list(map(int, input().split())) for _ in range(n)]
	print(solve())
main()


n = int(input())
l1 = []
l2 = []
for i in range(n):
	(a, b) = map(int, input().split())
	l1.append(a)
	l2.append(b)
if l1 != l2:
	print('rated')
else:
	flag = 0
	test_list1 = l1[:]
	test_list1.sort(reverse=True)
	if test_list1 == l1:
		flag = 1
	if flag == 1:
		print('maybe')
	else:
		print('unrated')


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
s = get_int()
matrix = [get_int_list() for i in range(s)]
unchanged = True
maybe = True
for i in range(s):
	if matrix[i][0] != matrix[i][1]:
		unchanged = False
		break
for i in range(s - 1):
	if matrix[i][0] < matrix[i + 1][0]:
		maybe = False
		break
if unchanged:
	if maybe:
		print('maybe')
	else:
		print('unrated')
else:
	print('rated')


s = 'maybe'
n = int(input())
a = []
for i in range(n):
	(bf, af) = [int(i) for i in input().split()]
	a.append(bf)
	if bf != af:
		s = 'rated'
if s != 'rated':
	for i in range(n - 1):
		for j in range(i + 1, n):
			if a[i] < a[j]:
				s = 'unrated'
				break
		if s == 'unrated':
			break
print(s)


n = int(input())
d = []
c = []
count = 0
for i in range(n):
	(a, b) = map(str, input().split())
	d.append(int(a))
	if int(a) != int(b):
		count = 1
		break
	else:
		c.append(int(a))
if count == 1:
	print('rated')
else:
	c.sort(reverse=True)
	if c == d:
		print('maybe')
	else:
		print('unrated')


def answer():
	for x in a:
		if x[0] - x[1]:
			return 'rated'
	a.sort(reverse=True, key=lambda x: x[0])
	for i in range(n):
		if a[i][-1] != i:
			return 'unrated'
	return 'maybe'
n = int(input())
a = [list(map(int, input().split())) + [i] for i in range(n)]
print(answer())


n = int(input())
rated = 'unrated'
prev = 0
no = True
for i in range(n):
	(a, b) = input().split()
	if a != b:
		rated = 'rated'
		break
	if i == 0:
		prev = int(b)
		continue
	if not (prev >= int(b) and no):
		no = False
	prev = int(b)
if rated == 'unrated':
	if no:
		print('maybe')
	else:
		print(rated)
else:
	print(rated)


n = int(input())
s = []
s1 = []
rate = 'maybe'
for i in range(n):
	(a, b) = list(map(int, input().split()))
	if a != b:
		rate = 'rated'
	s.append(a)
	s1.append(b)
if rate == 'maybe':
	f = 0
	for i in range(n - 1):
		if s[i] < s[i + 1]:
			rate = 'unrated'
print(rate)


from sys import exit
n = int(input())
before = [0] * n
after = [0] * n
for i in range(n):
	curr = list(map(int, input().split()))
	(before[i], after[i]) = (curr[0], curr[1])
	if before[i] != after[i]:
		print('rated')
		exit()
if sorted(before, reverse=True) != before:
	print('unrated')
else:
	print('maybe')


(n, r, o) = (int(input()), 0, 0)
(c, d) = map(int, input().split())
if c != d:
	r = 1
for i in range(n - 1):
	(a, b) = map(int, input().split())
	if b != a:
		r = 1
	if a > c:
		o = 1
	(c, d) = (a, b)
print('rated' if r else 'unrated' if o else 'maybe')


n = int(input())
sa = []
sb = []
for i in range(n):
	(a, b) = map(int, input().split())
	sa.append(a)
	sb.append(b)
if sa == sb:
	d = sa.copy()
	sa.sort(reverse=True)
	if sa == d:
		print('maybe')
	else:
		print('unrated')
else:
	print('rated')


n = int(input())
a = [0] * n
b = [0] * n
s1 = True
s2 = True
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
	if a[i] != b[i]:
		s1 = False
if a == list(reversed(sorted(a))):
	s2 = False
if not s1:
	print('rated')
elif not s2:
	print('maybe')
else:
	print('unrated')


def rated(t):
	f = []
	s = []
	for i in range(t):
		(a, b) = map(int, input().split())
		f.append(a)
		s.append(b)
		if f[i] != s[i]:
			print('rated')
			return
	for i in range(1, t):
		if f[i] > f[i - 1]:
			print('unrated')
			return
	print('maybe')
t = int(input())
rated(t)


n = int(input())
(z, old) = (0, 4127)
for i in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		print('rated')
		exit(0)
	if old < a:
		z = 1
	old = a
if z == 1:
	print('unrated')
else:
	print('maybe')


n = int(input())
l = []
li = []
for i in range(n):
	(a, b) = map(int, input().split())
	l.append(a)
	li.append(b)
if l == li:
	lis = l[:]
	lis.sort()
	lis.reverse()
	if lis != l:
		print('unrated')
	else:
		print('maybe')
else:
	print('rated')


n = int(input())
(a, b, tmp) = ([], [], [])
rated = False
for i in range(n):
	tmp = list(map(int, input().rstrip().split()))
	a.append(tmp[0])
	b.append(tmp[1])
	if tmp[0] != tmp[1]:
		print('rated')
		exit()
for i in range(1, n):
	if a[i] > a[i - 1]:
		print('unrated')
		exit()
print('maybe')


n = int(input())
a1 = []
b1 = []
flag = 0
for i in range(n):
	(a, b) = [int(x) for x in input().split()]
	a1.append(a)
	b1.append(b)
	if a1[i] != b1[i]:
		print('rated')
		flag = 1
		break
if flag == 0:
	a1.reverse()
	b1.sort()
	for j in range(n):
		if b1[j] != a1[j]:
			flag = 2
			break
if flag == 2:
	print('unrated')
if flag == 0:
	print('maybe')


n = int(input())
arr = []
x = []
for i in range(n):
	arr.append(list(map(int, input().split())))
	if arr[i][0] != arr[i][1]:
		print('rated')
		exit(0)
	x.append(arr[i])

def GetSecond(elem):
	return elem[1]
x.sort(key=GetSecond, reverse=True)
if arr == x:
	print('maybe')
else:
	print('unrated')


n = int(input())
(l, d) = ([], [])
for i in range(n):
	(x, y) = map(int, input().split())
	l.append(x)
	d.append(y)
f = 0
for i in range(n):
	if l[i] != d[i]:
		f = 1
		break
if f == 1:
	print('rated')
elif l == sorted(l, reverse=True):
	print('maybe')
else:
	print('unrated')


t = int(input())
m = t
p = 5000
f = True
while t:
	t -= 1
	(a, b) = input().strip().split(' ')
	if a != b:
		print('rated')
		exit()
	else:
		(a, b) = (int(a), int(b))
		if f == True:
			if a <= p:
				f = True
			else:
				f = False
		p = a
if f:
	print('maybe')
else:
	print('unrated')


n = int(input())
arr1 = []
arr2 = []
count = ''
for _ in range(n):
	(a, b) = map(int, input().split())
	arr1.append(a)
	arr2.append(b)
for i in range(n):
	if arr1[i] != arr2[i]:
		count = 'rated'
		print(count)
		break
if count != 'rated':
	arr3 = arr1[:]
	arr3.sort(reverse=True)
	if arr3 == arr1:
		count = 'maybe'
	else:
		count = 'unrated'
	print(count)


def sol():
	n = int(input())
	flag = False
	last = None
	for i in range(n):
		(a, b) = map(int, input().split(' '))
		if a != b:
			return 'rated'
		if last is not None and a > last:
			flag = True
		last = a
	if flag:
		return 'unrated'
	else:
		return 'maybe'
print(sol())


n = int(input())
a = []
rated = False
for k in range(n):
	(i, j) = map(int, input().split())
	if i != j:
		rated = True
	a.append((i, j))
if rated:
	print('rated')
else:
	b = list(sorted(a, reverse=True))
	if a == b:
		print('maybe')
	else:
		print('unrated')


(prev, curr) = ([], [])
n = int(input())
not_sorted = False
for i in range(n):
	(x, y) = (int(i) for i in input().split())
	if len(prev) > 0 and x > prev[-1]:
		not_sorted = True
	prev.append(x)
	curr.append(y)
for (i, v) in enumerate(prev):
	if curr[i] != v:
		print('rated')
		exit()
if not_sorted:
	print('unrated')
else:
	print('maybe')


n = int(input())
arr = []
flag = True
brr = []
for i in range(n):
	(x, y) = map(int, input().split())
	if x != y:
		print('rated')
		flag = False
		break
	arr.append([x, y])
	brr.append(arr[i][0])
crr = []
if flag:
	for i in range(n):
		crr.append(brr[i])
	crr.sort(reverse=True)
	if brr == crr:
		print('maybe')
	else:
		print('unrated')


n = int(input())
res1 = []
result = 0
for i in range(n):
	res = [i for i in input().split()]
	res1.append(int(res[0]))
	if res[0] != res[1]:
		result = 1
if result:
	print('rated')
elif res1 == sorted(res1, key=int, reverse=True):
	print('maybe')
else:
	print('unrated')


l = []
for _ in range(int(input())):
	c = 0
	(a, b) = map(int, input().split())
	l.append(a)
	if a != b:
		print('rated')
		break
else:
	k = sorted(l)
	l.reverse()
	if l == k:
		print('maybe')
	else:
		print('unrated')


import sys
x = []
j = 0
x1 = int(input())
for _ in range(x1):
	(x2, x3) = input().split()
	x.append(int(x2))
	x.append(int(x3))
	if abs(int(x3) - int(x2)) > 0:
		j += 1
if j >= 1:
	print('rated')
	sys.exit()
if x == sorted(x, reverse=True):
	print('maybe')
	sys.exit()
else:
	print('unrated')


n = int(input())
p = list((list(map(int, input().split())) for _ in range(n)))
if any((p[i][0] != p[i][1] for i in range(n))):
	print('rated')
elif p == sorted(p, reverse=True):
	print('maybe')
else:
	print('unrated')


l = []
t = []
for i in range(int(input())):
	(a, b) = list(map(int, input().strip().split()))
	if abs(b - a) == 0:
		l += [a]
		t += [a]
	else:
		print('rated')
		break
else:
	t.sort(reverse=True)
	if l == t:
		print('maybe')
	else:
		print('unrated')


arr = []
num = int(input())
for t in range(num):
	arr.append(list(map(int, input().split())))
for t in arr:
	if t[0] != t[1]:
		print('rated')
		exit()
for t in range(num):
	for tt in range(t):
		if arr[t][0] > arr[tt][0]:
			print('unrated')
			exit()
print('maybe')


def inp():
	return map(int, input().split())

def arr_inp():
	return [int(x) for x in input().split()]

def print_arr(arr):
	print(*arr, sep=' ')
n = int(input())
(count, max) = (0, 4127)
for i in range(n):
	(a, b) = inp()
	if a == b:
		if a <= max:
			count += 1
			max = a
	else:
		print('rated')
		exit()
if count == n:
	print('maybe')
else:
	print('unrated')


import sys
n = int(input())
ratings = []
out = False
for line in sys.stdin.readlines():
	(r1, r2) = map(int, line.split())
	if r1 != r2:
		print('rated')
		out = True
		break
	else:
		ratings.append((r1, r2))
if not out:
	r_copy = ratings.copy()
	ratings = sorted(ratings, reverse=True)
	print('maybe' if ratings == r_copy else 'unrated')


def editor():
	import sys
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def solve():
	n = int(input())
	before = []
	after = []
	changed = False
	for i in range(n):
		(i1, i2) = map(int, input().split())
		if i1 != i2:
			changed = True
		before.append(i1)
		after.append(i2)
	if changed:
		print('rated')
		return
	if before == sorted(before, reverse=True):
		print('maybe')
	else:
		print('unrated')
tc = 1
for t in range(tc):
	solve()


n = int(input())
l = []
change = 0
for i in range(n):
	(before, after) = map(int, input().split())
	if before != after:
		change = 1
	l.append((before, after))
if change == 1:
	print('rated')
elif l == sorted(l, key=lambda x: x[1], reverse=True):
	print('maybe')
else:
	print('unrated')


n = int(input())
k = []
l = []
for i in range(n):
	(a, b) = [int(i) for i in input().split()]
	l.append(a)
	k.append(b)
if l != k:
	print('rated')
else:
	f = sorted(l, reverse=True)
	if f == l:
		print('maybe')
	else:
		print('unrated')


n = int(input())
scores = []
rating = 'maybe'
standings = -1
for i in range(n):
	score = list(map(int, input().split(' ')))
	scores.append(score)
counter = False
for score in scores:
	if score[0] != score[1]:
		rating = 'rated'
		break
	else:
		if not counter:
			counter = True
		elif score[0] > standings:
			rating = 'unrated'
		standings = score[0]
print(rating)


n = int(input())
seen = set()
before = []
after = []
for x in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		print('rated')
		break
	before.append(a)
	after.append(b)
else:
	if after == sorted(after, reverse=True):
		print('maybe')
	else:
		print('unrated')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def main():
	n = I()
	aa = [LI() for _ in range(n)]
	c = inf
	f = 0
	for (a, b) in aa:
		if a != b:
			return 'rated'
		if c < a:
			f = 1
		c = a
	if f:
		return 'unrated'
	return 'maybe'
print(main())


import sys

def main():
	n = int(sys.stdin.readline().rstrip())
	rates = []
	changed = False
	increasing = False
	prev_line = sys.float_info.max
	for lno in range(n):
		(prev, post) = map(int, sys.stdin.readline().rstrip().split())
		if prev != post:
			print('rated')
			return 0
		elif prev_line < post:
			increasing = True
		prev_line = post
	if not increasing:
		print('maybe')
	else:
		print('unrated')
main()


a = int(input())
k = 0
l = []
l1 = []
for i in range(a):
	(x, y) = map(int, input().split())
	if x != y:
		k += 1
	l.append([x, y])
	l1.append([x, y])
l1.sort()
l1.reverse()
if k > 0:
	print('rated')
elif l1 == l:
	print('maybe')
else:
	print('unrated')


n = int(input())
l = []
for i in range(n):
	(a, b) = map(int, input().split())
	l.append(a)
	if a != b:
		print('rated')
		break
else:
	for i in range(len(l) - 1):
		if l[i + 1] > l[i]:
			print('unrated')
			break
	else:
		print('maybe')


def main():
	n = int(input())
	arr = []
	k = n
	while k:
		(a, b) = map(int, input().split())
		if a != b:
			print('rated')
			return
		arr.append(a)
		k -= 1
	brr = sorted(arr, reverse=True)
	for i in range(n):
		if arr[i] != brr[i]:
			print('unrated')
			return
	print('maybe')
main()


n = int(input())
ordered = True
rated = False
(oldA, oldB) = (4126, 4126)
for _ in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		rated = True
	if a > oldA:
		ordered = False
	oldA = a
if rated:
	print('rated')
else:
	print('maybe' if ordered else 'unrated')


n = int(input())
arr = []
brr = []
crr = []
while n != 0:
	(a, b) = map(int, input().split())
	arr.append(a)
	brr.append(b)
	crr.append(b)
	n = n - 1
c = 0
for i in range(len(arr)):
	if arr[i] == brr[i]:
		continue
	elif arr[i] != brr[i]:
		print('rated')
		c = 1
		exit(0)
if c == 0:
	crr.sort(reverse=True)
	if crr == arr:
		print('maybe')
	else:
		print('unrated')


n = int(input())
ok1 = True
lst = []
while n >= 1:
	(a, b) = map(int, input().split())
	if a != b:
		ok1 = False
		break
	lst.append(a)
	n -= 1
arr = sorted(lst, reverse=True)
if ok1 == False:
	print('rated')
elif arr == lst:
	print('maybe')
else:
	print('unrated')


k = []
n = 0
for i in ' ' * int(input()):
	(a, b) = map(int, input().split())
	k += [a]
	n += a != b
if n:
	print('rated')
elif all((i == j for (i, j) in zip(k, sorted(k, reverse=True)))):
	print('maybe')
else:
	print('unrated')


n = int(input())
(arr1, arr2) = (list(), list())
for i in range(n):
	line = [int(i) for i in input().split()]
	arr1.append(line[0])
	arr2.append(line[1])
cnt = 0
for i in range(n):
	if not arr1[i] == arr2[i]:
		cnt += 1
		break
if cnt == 0:
	if arr1 == sorted(arr1, reverse=True):
		print('maybe')
	else:
		print('unrated')
else:
	print('rated')


k = []
b = []
for i in range(int(input())):
	l = list(map(int, input().split(' ')))
	b.append(l)
	if len(list(set(l))) % 2 == 0:
		k.append(l)
z = sorted(b, reverse=True)
if len(k) != 0:
	print('rated')
elif z == b:
	print('maybe')
else:
	print('unrated')


x = int(input())
y = []
inp = []
test = 0
for i in range(x):
	y = list(map(int, input().strip().split()))
	if y[0] != y[1]:
		print('rated')
		test = 1
		break
	inp.append(y)
	if i != 0:
		if inp[i] > inp[i - 1]:
			test = 2
if test == 0:
	print('maybe')
elif test == 2:
	print('unrated')


from sys import stdin, stdout
n = int(stdin.readline())
challengers = []
for i in range(n):
	(a, b) = map(int, stdin.readline().split())
	if a != b:
		stdout.write('rated')
		break
	else:
		challengers.append((a, b))
else:
	if challengers[::-1] == sorted(challengers):
		stdout.write('maybe')
	else:
		stdout.write('unrated')


for _ in range(1):
	n = int(input())
	flag = False
	r = list()
	for _ in range(n):
		(a, b) = map(int, input().split())
		r.append([a, b])
	rSorted = [x for x in r]
	rSorted.sort(reverse=True)
	for (v, d) in r:
		if v != d:
			print('rated')
			flag = True
			break
	if rSorted == r and (not flag):
		print('maybe')
	elif not flag:
		print('unrated')


from sys import stdin, stdout
number_of_participant = int(stdin.readline())
rating = []
for i in range(number_of_participant):
	(x, y) = map(int, stdin.readline().split())
	if x != y:
		stdout.write('rated\n')
		exit()
	rating.append(x)
rating_sorted = rating.copy()
rating_sorted.sort(reverse=True)
if rating_sorted == rating:
	stdout.write('maybe\n')
	exit()
stdout.write('unrated\n')


def main():
	n = int(input())
	rates = []
	rated_known = False
	for _ in range(n):
		[before, after] = [int(x) for x in input().split()]
		if before != after:
			rated_known = True
		else:
			rates += [before]
	if rated_known:
		print('rated')
	else:
		try:
			next((i for i in range(1, n) if rates[i] > rates[i - 1]))
			print('unrated')
		except StopIteration:
			print('maybe')
main()


n = int(input())
a = []
a1 = []
for i in range(n):
	(f, s) = map(int, input().split())
	if f != s:
		print('rated')
		exit(0)
	a.append(s)
	a1.append(s)
a.sort()
if a[::-1] == a1:
	print('maybe')
	exit(0)
print('unrated')


def is_rated():
	n = int(input())
	results = []
	no_sort = False
	for i in range(n):
		(a, b) = input().split(' ')
		if i > 0 and last_a < int(a):
			no_sort = True
		if int(a) != int(b):
			return 'rated'
		(last_a, last_b) = (int(a), int(b))
		results.append([int(a), int(b)])
	if no_sort:
		return 'unrated'
	return 'maybe'
print(is_rated())


n = int(input())
max = 4127
T = True
for i in range(n):
	(l, r) = map(int, input().split())
	if l == r:
		if max < l:
			T = False
		max = l
	else:
		print('rated')
		break
else:
	if T:
		print('maybe')
	else:
		print('unrated')


n = int(input())
m = 4126
f = False
for i in range(n):
	(a, b) = [int(i) for i in input().split()]
	if a != b:
		print('rated')
		exit(0)
	if a > m:
		f = True
	m = min(a, m)
if f:
	print('unrated')
	exit(0)
print('maybe')


n = int(input())
l = []
c = 0
for i in range(n):
	(x, y) = map(int, input().split())
	t = (x, y)
	l.append(t)
	if x != y:
		c += 1
if c > 0:
	print('rated')
else:
	li = sorted(l, reverse=True)
	if l == li:
		print('maybe')
	else:
		print('unrated')


n = int(input())
before = []
after = []
for i in range(n):
	line = input().split()
	before.append(int(line[0]))
	after.append(int(line[1]))
if before != after:
	print('rated')
elif before != sorted(before, reverse=True):
	print('unrated')
else:
	print('maybe')


y = int(input())
my_arr = []
flag = 0
while y > 0:
	(a, b) = input().split()
	b = int(b)
	a = int(a)
	if a != b:
		flag += 1
	my_arr.append(a)
	y = y - 1
if flag > 0:
	print('rated')
elif all((my_arr[i] >= my_arr[i + 1] for i in range(len(my_arr) - 1))):
	print('maybe')
else:
	print('unrated')


from collections import deque as de
import math
from collections import Counter as cnt
from functools import reduce
from typing import MutableMapping
from itertools import groupby as gb
from fractions import Fraction as fr

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic

def Log2(x):
	return math.log10(x) / math.log10(2)

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))

def ceildiv(x, y):
	return (x + y - 1) // y

def di():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))
n = int(input())
aftercontest = []
ch = 0
while n:
	n -= 1
	(a, b) = di()
	if abs(a - b) != 0:
		ch = 1
	aftercontest.append(b)
if ch:
	print('rated')
else:
	temp = aftercontest.copy()
	temp.sort(reverse=True)
	if temp == aftercontest:
		print('maybe')
	else:
		print('unrated')


def main():
	n = int(input())
	a = []
	b = []
	for i in range(n):
		(ai, bi) = map(int, input().split())
		a.append(ai)
		b.append(bi)
	if a == b:
		if all((a[i] >= a[i + 1] for i in range(n - 1))):
			print('maybe')
		else:
			print('unrated')
	else:
		print('rated')
main()


l1 = []
l2 = []
num = int(input())
for i in range(num):
	(n, m) = map(int, input().split())
	l1.append(n)
	l2.append(m)
if l1 != l2:
	print('rated')
else:
	res = 'maybe'
	l1.sort(reverse=True)
	for i in range(num):
		if l1[i] != l2[i]:
			res = 'unrated'
			break
	print(res)


(x, y) = ([], [])
for i in range(int(input())):
	l = []
	(a, b) = list(map(int, input().split()))
	l.append(a)
	l.append(b)
	x.append(l)
	y.append(a)
for i in x:
	if i[1] > i[0] or i[1] < i[0]:
		print('rated')
		break
else:
	for i in range(len(y)):
		if i != len(y) - 1 and y[i] < y[i + 1]:
			print('unrated')
			break
	else:
		print('maybe')


n = int(input())
rated = False
unrated = False
(b, a) = map(int, input().split())
if a != b:
	rated = True
m = b
for i in range(n - 1):
	(b, a) = map(int, input().split())
	if a != b:
		rated = True
		break
	if m < b:
		unrated = True
	m = b
if rated:
	print('rated')
elif unrated:
	print('unrated')
else:
	print('maybe')


n = int(input())
ans = []
for i in range(n):
	ans.append(list(map(int, input().split())))
flag = 0
for i in ans:
	if i[0] != i[1]:
		flag = 1
	else:
		pass
if flag == 1:
	print('rated')
	exit()
else:
	for i in range(n):
		for j in range(i):
			if ans[i][0] > ans[j][0]:
				print('unrated')
				exit()
print('maybe')


n = int(input())
a = [[int(i) for i in input().split()] for i in range(n)]
ans = 'maybe'
for i in range(n):
	if a[i][0] != a[i][1]:
		ans = 'rated'
		break
else:
	for i in range(n - 1):
		if a[i][0] < a[i + 1][0]:
			ans = 'unrated'
			break
print(ans)


Size = int(input())
List = list()
for i in range(Size):
	X = list(map(int, input().split()))
	if X[1] != X[0]:
		print('rated')
		exit(0)
	List.append(X[0])
print('unrated' if List != sorted(List, reverse=True) else 'maybe')


x = int(input())
lst1 = []
lst2 = []
for i in range(x):
	(y, z) = map(int, input().split())
	lst1.append(y)
	lst2.append(z)
	if lst1[i] != lst2[i]:
		print('rated')
		exit(0)
for i in range(1, x):
	if lst1[i] > lst1[i - 1]:
		print('unrated')
		break
else:
	print('maybe')


t = int(input())
f = 1
g = 0
a = []
while t:
	t -= 1
	a.append(list(map(int, input().split())))
for i in range(len(a)):
	if a[i][0] != a[i][1]:
		f = 0
	if i != 0 and a[i][0] > a[i - 1][0]:
		g = 1
if f == 0:
	print('rated')
elif g:
	print('unrated')
else:
	print('maybe')


N = int(input())
A = [list(map(int, input().split())) for i in range(N)]
if any((A[i][1] - A[i][0] for i in range(N))):
	print('rated')
elif any((A[i][0] - A[i + 1][0] < 0 for i in range(N - 1))):
	print('unrated')
else:
	print('maybe')


n = int(input())
x = []
for i in range(n):
	x += [int(x) for x in input().split()]
i = 0
a = []
while i != 2 * n:
	if x[i] != x[i + 1]:
		print('rated')
		break
	a.append(x[i])
	i += 2
if i == 2 * n:
	if a == sorted(a, reverse=True):
		print('maybe')
	else:
		print('unrated')


n = int(input())
rated = False
c = []
for i in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		rated = True
	c.append(a)
if rated == True:
	print('rated')
elif c == sorted(c, reverse=True):
	print('maybe')
else:
	print('unrated')


from sys import stdin, stdout
n = int(stdin.readline().rstrip())
a = []
b = []
for i in range(n):
	(x, y) = list(map(int, stdin.readline().rstrip().split()))
	a.append(x)
	b.append(y)
rated = 0
for i in range(n):
	if a[i] != b[i]:
		rated = 1
		break
if not rated:
	for i in range(n - 1):
		if a[i] < a[i + 1]:
			rated = -1
if rated == 1:
	print('rated')
elif rated == 0:
	print('maybe')
else:
	print('unrated')


l1 = []
l2 = []
l3 = []
k = int(input())
for i in range(k):
	(x, y) = map(int, input().split())
	l1.append(x)
	l2.append(y)
	l3.append(y)
count = 0
for i in range(k):
	if l1[i] == l2[i]:
		count += 1
l3.sort(reverse=True)
count1 = 0
for i in range(k):
	if l2[i] == l3[i]:
		count1 += 1
if count != k:
	print('rated')
elif count == k and count1 == k:
	print('maybe')
else:
	print('unrated')


import sys
MOD = 1000000007

def inp():
	return sys.stdin.readline().strip()

def ii():
	return int(inp())

def iis():
	return [int(i) for i in inp().split()]

def solve():
	n = ii()
	ratings = [iis() for _ in range(n)]
	for (a, b) in ratings:
		if a != b:
			return 'rated'
	for i in range(n):
		for j in range(i + 1, n):
			if ratings[i][0] < ratings[j][0]:
				return 'unrated'
	return 'maybe'
print(solve())


if str is bytes:
	from itertools import izip as zip

def is_sorted(l):
	return all((a >= b for (a, b) in zip(l, l[1:])))
n = int(input())
before = []
i = -1
for _ in range(n):
	tmp = list(map(int, input().split()))
	if tmp[0] != tmp[1]:
		i = 1
	else:
		before.append(tmp[0])
if i == 1:
	print('rated')
ist = is_sorted(before)
if i == -1 and ist:
	print('maybe')
elif i == -1 and (not ist):
	print('unrated')


n = int(input())
t = []
f = True
for i in range(n):
	(a, b) = map(int, input().split())
	if a - b != 0:
		print('rated')
		exit()
	else:
		t.append(a)
		if min(t) != a:
			f = False
print('unrated' if f is False else 'maybe')


l = []
for _ in range(int(input())):
	l1 = list(map(int, input().split()))
	l.append(l1[0])
	if l1[0] != l1[1]:
		print('rated')
		exit()
x = sorted(l, reverse=True)
print(['unrated', 'maybe'][l == x])


n = int(input())
results = []
for i in range(n):
	results.append(list(map(int, input().split())))
for x in results:
	if x[0] != x[1]:
		print('rated')
		exit()
for i in range(len(results) - 1):
	if results[i][0] < results[i + 1][0]:
		print('unrated')
		exit()
print('maybe')


n = int(input())
first_rate = []
second_rate = []
for i in range(n):
	k = [int(i) for i in input().split()]
	first_rate.append(k[0])
	second_rate.append(k[1])
if first_rate == second_rate:
	first_rate_sorted = sorted(first_rate, reverse=True)
	if first_rate_sorted == first_rate:
		print('maybe')
	else:
		print('unrated')
else:
	print('rated')


import sys
n = int(input())
lst = []
for i in range(n):
	L = [int(i) for i in input().split()]
	if L[0] != L[1]:
		print('rated')
		sys.exit()
	else:
		lst.append(L)
for i in range(n):
	for j in range(i + 1, n):
		if lst[i][0] < lst[j][0]:
			print('unrated')
			sys.exit()
print('maybe')


n = int(input())
ans = ''
i = 0
a = 0
prev = float('inf')
while i < n and ans == '':
	(x, y) = map(int, input().split())
	if x != y:
		ans = 'rated'
	elif x > prev:
		a = 1
	prev = x
	i += 1
if ans == '':
	if a:
		ans = 'unrated'
	else:
		ans = 'maybe'
print(ans)


from sys import maxsize, stdout, stdin, stderr
import re
tup = lambda : map(int, stdin.readline().split())
I = lambda : int(stdin.readline())
lint = lambda : [int(x) for x in stdin.readline().split()]
S = lambda : stdin.readline().replace('\n', '').strip()

def grid(r, c):
	return [lint() for i in range(r)]

def debug(*args, c=6):
	print('\x1b[3{}m'.format(c), *args, '\x1b[0m', file=stderr)
n = I()
d = []
f = 1
k = 0
for _ in range(n):
	(a, b) = tup()
	d.append((a, b))
	if a != b and f == 1:
		f = 0
		print('rated')
if f == 1:
	kk = sorted(d, reverse=True)
	c = 0
	r = 1
	for (k, v) in d:
		if k == kk[c][0]:
			pass
		elif k < kk[c][0]:
			r = 0
		c += 1
	if r == 0:
		print('unrated')
	else:
		print('maybe')


n = int(input())
a = []
for i in range(n):
	r = list(map(int, input().split()))
	a.append(r)
b = sorted(a, reverse=True)
for i in a:
	if i[1] - i[0] != 0:
		print('rated')
		exit(0)
for i in range(n):
	if a[i] != b[i]:
		print('unrated')
		exit(0)
c = 0
for i in a:
	if i[1] - i[0] == 0:
		c += 1
if c == n:
	print('maybe')


n = int(input())
flag = 0
rs = []
for i in range(n):
	ab = input().strip().split(' ')
	a = int(ab[0])
	b = int(ab[1])
	if a != b:
		print('rated')
		flag = 1
		break
	else:
		rs.append(b)
if flag == 0:
	rssrt = rs.copy()
	rssrt.sort(reverse=True)
	if rssrt == rs:
		print('maybe')
	else:
		print('unrated')


import math
import sys
import string

def ri():
	return input()

def ii():
	return int(input())

def li():
	return input().split()

def mi():
	return list(map(int, input().split()))
n = ii()
ar = []
for i in range(n):
	(a, b) = mi()
	ar.append([a, b])
for i in range(n):
	if ar[i][0] != ar[i][1]:
		print('rated')
		exit()
for i in range(n - 1):
	if ar[i][0] < ar[i + 1][1]:
		print('unrated')
		exit()
print('maybe')


n = int(input())
last_rating = None
is_sorted = True
is_changed = False
for _ in range(n):
	s = input().split()
	(r1, r2) = (int(s[0]), int(s[1]))
	if r1 != r2:
		is_changed = True
	if last_rating != None and last_rating < r1:
		is_sorted = False
	last_rating = r1
print('rated' if is_changed else 'maybe' if is_sorted else 'unrated')


(k, f) = ([], 0)
for x in range(int(input())):
	(a, b) = map(int, input().split())
	if a != b:
		f = 1
		print('rated')
		break
	else:
		k.append(a)
if f == 0:
	l = k.copy()
	k.sort()
	k.reverse()
	if k == l:
		print('maybe')
	else:
		print('unrated')


number_of_round_participants = int(input())
before = list()
after = list()
i = 0
while i < number_of_round_participants:
	b_and_a = input().split()
	before.append(int(b_and_a[0]))
	after.append(int(b_and_a[1]))
	i += 1
if before != after:
	print('rated')
else:
	competition = 'maybe'
	before.sort(reverse=True)
	for j in range(number_of_round_participants):
		if before[j] != after[j]:
			competition = 'unrated'
			break
	print(competition)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
x = inp()
cofrep = 0
l = []
for i in range(x):
	(y, z) = invr()
	if y == z:
		cofrep += 1
	l.append(y)
	l.append(z)
if cofrep * 2 == len(l):
	sl = sorted(l, reverse=True)
	if l == sl:
		print('maybe')
	else:
		print('unrated')
else:
	print('rated')


x = int(input(''))
r = []
rated = 0
maybe = 1
for i in range(x):
	arr = [int(x) for x in input('').split()]
	if arr[0] != arr[1]:
		rated = 1
	r.append(arr[0])
r2 = r[:]
r2.sort(reverse=True)
for i in range(x):
	if r[i] != r2[i]:
		maybe = 0
		break
if rated == 0 and maybe == 1:
	print('maybe')
elif rated == 0:
	print('unrated')
elif rated == 1:
	print('rated')


n = int(input())
arr = []
f = 0
for i in range(n):
	rank = list(map(int, input().rstrip().split()))
	s = rank[0]
	e = rank[1]
	arr.append(s)
	if s != e:
		f = 1
if f == 0:
	f1 = 0
	for j in range(n - 1):
		if arr[j] < arr[j + 1]:
			f1 = 1
	if f1 == 0:
		print('maybe')
	else:
		print('unrated')
else:
	print('rated')


n = int(input())
m = 5000
flag = 'maybe'
for i in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		print('rated')
		quit()
	if m - b < 0:
		flag = 'unrated'
	m = b
print(flag)


n = int(input())
a = []
b = []
for _ in range(n):
	(p, q) = map(int, input().split())
	a.append(p)
	b.append(q)
c = sorted(b, reverse=True)
if a == b and b == c:
	print('maybe')
elif a != b:
	print('rated')
elif a == b:
	print('unrated')


n = int(input())
mb = True
nooo = False
last = 5000
for i in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		nooo = True
	if last < a:
		mb = False
	last = a
if nooo:
	print('rated')
elif mb:
	print('maybe')
else:
	print('unrated')


import random
import math
import sys
n = int(input())
l = [[0 for i in range(2)] for j in range(n)]
for i in range(0, n):
	t = [int(x) for x in input().split()]
	for j in range(0, 2):
		l[i][j] = t[j]
rate = 0
for i in range(0, n):
	if l[i][0] != l[i][1]:
		rate = 1
		break
if rate == 1:
	print('rated')
	sys.exit()
unrated = 0
for i in range(0, n - 1):
	if l[i][0] < l[i + 1][0]:
		unrated = 1
		break
if unrated == 1:
	print('unrated')
	sys.exit()
print('maybe')


n = int(input())
l = 0
r = 0
ll = []
ll1 = []
for i in range(n):
	a = input().split(' ')
	l += int(a[0])
	r += int(a[1])
	ll.append(list(map(int, a)))
ll1 = list(ll)
flag = 0
flag1 = 1
for k in range(n):
	se = set(ll[k])
	if len(se) == 2:
		flag1 = 0
		break
if flag1 == 0:
	print('rated')
else:
	ll.sort(reverse=True)
	for j in range(n):
		if ll[j] == ll1[j]:
			flag = 1
		else:
			flag = 0
			break
	if flag == 0:
		print('unrated')
	else:
		print('maybe')


t = int(input())
left = []
right = []
for i in range(t):
	(x, y) = input().split()
	(x, y) = (int(x), int(y))
	left.append(x)
	right.append(y)
if left != right:
	print('rated')
elif left == right and sorted(left, reverse=True) != left and (sorted(right, reverse=True) != right):
	print('unrated')
else:
	print('maybe')


n = int(input())
flag = 0
aaa = []
for i in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		flag = 1
	else:
		aaa.append(a)
if flag == 1:
	print('rated')
elif list(reversed(aaa)) != sorted(aaa):
	print('unrated')
else:
	print('maybe')


n = int(input())
l = []
for i in range(n):
	m = list(map(int, input().split()))
	l.append(m)
c = 0
t = 0
p = 0
h = []
for i in range(n):
	h.append(l[i][1])
	if l[i][0] != l[i][1]:
		c += 1
	elif l[i][0] == l[i][1]:
		t += 1
h.sort()
for i in range(n - 1, -1, -1):
	if l[n - 1 - i][1] == h[i]:
		p += 1
if t == n and p == n:
	print('maybe')
elif t == n and p != n:
	print('unrated')
elif c > 0:
	print('rated')


n = int(input())
x = []
f = 0
for _ in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		f = 1
	x.append(a)
if f == 1:
	print('rated')
elif sorted(x)[::-1] == x:
	print('maybe')
else:
	print('unrated')


t = int(input())
a = []
b = []
for i in range(0, t):
	(n, m) = map(int, input().split())
	a.append(n)
	b.append(m)
c = list(a)
c.sort()
c = c[::-1]
p = 0
for i in range(0, len(a)):
	if a[i] != b[i]:
		p = 1
		break
if p == 1:
	print('rated')
elif c == a:
	print('maybe')
else:
	print('unrated')


n = int(input())
ans = None
c = []
for i in range(n):
	(a, b) = map(int, input().split())
	c.append(a)
	if a != b:
		ans = 'rated'
if ans != 'rated':
	for i in range(n):
		for j in range(i + 1, n):
			if c[i] < c[j]:
				ans = 'unrated'
				print(ans)
				exit()
	ans = 'maybe'
print(ans)


n = int(input())
x = 0
d = []
p = []
while x < n:
	(a, b) = map(int, input().split())
	d.append(a)
	p.append(b)
	x += 1
y = 0
while y < len(d):
	if d[y] != p[y]:
		print('rated')
		exit()
	y += 1
y = 1
s = 1
while y < len(p):
	if d[y] <= d[y - 1] and p[y] <= p[y - 1]:
		s += 1
	else:
		print('unrated')
		exit()
	y += 1
print('maybe')


import math as mt
import sys, string, bisect
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
d = defaultdict(int)
t = I()
l = []
for _ in range(t):
	(a, b) = M()
	l.append(a)
	if a != b:
		print('rated')
		exit()
d = sorted(l, reverse=True)
if l == d:
	print('maybe')
else:
	print('unrated')


n = int(input())
prev = 4500
o = 0
c = 0
for i in range(n):
	(l, r) = map(int, input().split())
	if l != r:
		c = 1
	elif l > prev:
		o = 1
	prev = l
if c:
	print('rated')
elif o:
	print('unrated')
else:
	print('maybe')


k = 0
test = []
for i in range(int(input())):
	rating = input().split()
	if int(rating[0]) != int(rating[1]):
		k = 1
	test.append(int(rating[0]))
lala = test[:]
lala.sort(reverse=True)
if k == 1:
	print('rated')
elif test == lala:
	print('maybe')
else:
	print('unrated')


n = int(input())
accept = 0
com = []
for i in range(n):
	ab = list(map(int, input().split()))
	com.append(ab)
	if ab[0] != ab[1]:
		accept = 1
if accept == 0:
	ac = 0
	for i in range(n - 1):
		if com[i][0] < com[i + 1][0]:
			ac = 1
			break
	if ac == 0:
		print('maybe')
	else:
		print('unrated')
else:
	print('rated')


n = int(input())
prev = 4127
answer = ''
for i in range(n):
	(a, b) = map(int, input().split(' '))
	if a != b:
		answer = 'rated'
	elif prev < a and answer != 'rated':
		answer = 'unrated'
	prev = a
print(answer if not len(answer) == 0 else 'maybe')


from sys import stdin, stdout
number_of_participant = int(stdin.readline())
rating_before = []
rating_after = []
for i in range(number_of_participant):
	rating_string = stdin.readline().split()
	rating_before.append(int(rating_string[0]))
	rating_after.append(int(rating_string[1]))
for i in range(number_of_participant):
	if rating_before[i] != rating_after[i]:
		stdout.write('rated\n')
		exit()
rating_before_sorted = rating_before.copy()
rating_before_sorted.sort(reverse=True)
for i in range(number_of_participant):
	if rating_before[i] != rating_before_sorted[i]:
		stdout.write('unrated\n')
		exit()
stdout.write('maybe\n')


n = int(input())
rated = False
scores = [0] * n
for i in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		rated = True
		break
	scores[i] = a
if rated:
	print('rated')
elif scores == sorted(scores, reverse=True):
	print('maybe')
else:
	print('unrated')


import sys
n = int(input())
kek = False
changed = False
prev = 9999
for i in range(n):
	(x, y) = list(map(int, input().split()))
	if x != y:
		changed = True
	if y > prev:
		kek = True
	prev = y
if not kek and (not changed):
	print('maybe')
elif kek and (not changed):
	print('unrated')
else:
	print('rated')


n = eval(input())
a = list(map(int, input().split()))
i = 2
flag1 = 0
while i <= n:
	b = list(map(int, input().split()))
	a = a + b
	i += 1
i = 0
while i < len(a) and flag1 == 0:
	if a[i] == a[i + 1]:
		flag1 = 0
	else:
		flag1 = 1
	i += 2
if flag1 == 0:
	i = 1
	flag2 = 0
	while i < len(a) - 1 and flag2 == 0:
		if a[i] >= a[i + 2]:
			flag2 = 0
		else:
			flag2 = 1
		i += 2
if flag1 == 1:
	print('rated')
elif flag2 == 0:
	print('maybe')
elif flag2 == 1:
	print('unrated')


ans = 'maybe'
n = int(input())
ratings = []
for _ in range(0, n):
	(a, b) = map(int, input().split())
	ratings.append((a, b))
	if a != b:
		ans = 'rated'
		break
if ans == 'maybe':
	for i in range(0, n):
		for j in range(i + 1, n):
			if ratings[j][1] > ratings[i][1]:
				ans = 'unrated'
				break
print(ans)


n = int(input())
x = []
y = []
for i in range(n):
	(a, b) = list(map(int, input().split()))
	x.append(a)
	y.append(b)
if x != y:
	print('rated')
elif y != sorted(y, reverse=True):
	print('unrated')
else:
	print('maybe')


n = int(input())
a = []
b = []
m = 0
for i in range(0, n):
	(g, h) = map(int, input().split())
	a.append(g)
	b.append(h)
for i in range(0, n):
	if a[i] != b[i]:
		m = 1
	else:
		pass
if sorted(a, reverse=True) != a and m == 0:
	m = 2
if sorted(a, reverse=True) == a and m == 0:
	m = 3
if m == 1:
	print('rated')
if m == 2:
	print('unrated')
if m == 3:
	print('maybe')


n = int(input())
rating = list()
ans = True
for i in range(n):
	(a, b) = map(int, input().split())
	rating.append(b)
	if a != b:
		print('rated')
		break
else:
	temp = float('inf')
	for j in rating:
		if j <= temp:
			temp = j
		else:
			print('unrated')
			break
	else:
		print('maybe')


(n, a, f) = (int(input()), [], 0)
for i in range(n):
	l = input().split()
	a += [l[0]]
	if l[0] != l[1]:
		f = 1
if f:
	print('rated')
elif a[::-1] == sorted(a, key=int):
	print('maybe')
else:
	print('unrated')


n = int(input())
s = []
for i in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		print('rated')
		break
	s.append(b)
else:
	if s[::-1] != sorted(s):
		print('unrated')
	else:
		print('maybe')


from sys import stdin, stdout
input = stdin.readline

def write(n, sep='\n'):
	stdout.write(str(n))
	stdout.write(sep)

def gil():
	return list(map(int, input().split()))
n = int(input())
m = 10000000.0
r = 0
for _ in range(n):
	(a, b) = gil()
	if a != b:
		r = 1
		break
	elif a > m:
		r = 2
	m = min(m, a)
if r == 0:
	print('maybe')
elif r == 1:
	print('rated')
else:
	print('unrated')


n = int(input())
rated = False
sure = False
(pre, post) = ([], [])
for i in range(n):
	(before, after) = map(int, input().split())
	if before - after != 0:
		rated = True
		sure = True
	pre.append(before)
	post.append(after)
if not rated and sorted(pre, reverse=True) != pre:
	rated = False
	sure = True
if sure:
	print('rated' if rated else 'unrated')
else:
	print('maybe')


n = int(input())
li1 = []
li2 = []
for i in range(n):
	(a, b) = map(int, input().split())
	li1.append(a)
	li2.append(b)
if li1 != li2:
	print('rated')
if li1 == li2:
	li3 = sorted(li2, reverse=True)
	if li1 == li3:
		print('maybe')
	else:
		print('unrated')


n = int(input())
rates = []
for _ in range(n):
	rates.append(list(map(int, input().split())))
for row in rates:
	if row[0] != row[1]:
		print('rated')
		exit()
for i in range(n):
	for j in range(i):
		if rates[i][0] > rates[j][0]:
			print('unrated')
			exit()
print('maybe')


def is_rated(n):
	inverted = False
	prev = 5000
	for _ in range(n):
		(r1, r2) = map(int, input().split())
		if r2 != r1:
			return 'rated'
		if r1 > prev:
			inverted = True
		prev = r1
	return 'unrated' if inverted else 'maybe'
n = int(input())
print(is_rated(n))


n = int(input())
before = [0] * n
after = [0] * n
for i in range(n):
	q = list(map(int, input().split()))
	(before[i], after[i]) = (q[0], q[1])
	if before[i] != after[i]:
		print('rated')
		exit()
if sorted(before, reverse=True) != before:
	print('unrated')
else:
	print('maybe')


n = int(input())
k = 0
mt = []
while n != 0:
	n -= 1
	lt = list(input().split())
	if lt[0] != lt[1]:
		print('rated')
		k = 1
		break
	mt.append(int(lt[0]))
if k == 0:
	l = len(mt)
	if l == 1:
		print('maybe')
	else:
		lt = sorted(mt, reverse=True)
		for i in range(l):
			if lt[i] != mt[i]:
				k = 1
				break
		if k == 0:
			print('maybe')
		else:
			print('unrated')


a = []
b = []
for _ in range(0, int(input())):
	(x, y) = map(int, input().split())
	a.append(x)
	b.append(y)
c = 0
for i in range(0, len(a)):
	if a[i] == b[i]:
		c = c + 1
if c == len(a):
	c = 0
	a.sort()
	j = len(a) - 1
	for i in range(0, len(a)):
		if a[j] == b[i]:
			j = j - 1
			c = c + 1
	if c == len(a):
		print('maybe')
	else:
		print('unrated')
else:
	print('rated')


import math
from math import gcd, floor, sqrt, log

def iin():
	return int(input())

def sin():
	return input().strip()

def listin():
	return list(map(int, input().strip().split()))

def liststr():
	return list(map(str, input().strip().split()))

def ceill(x):
	return int(x) if x == int(x) else int(x) + 1

def ceilldiv(x, d):
	x // d if x % d == 0 else x // d + 1

def LCM(a, b):
	return a * b // gcd(a, b)

def solve():
	n = iin()
	x = []
	y = []
	for i in range(n):
		q = listin()
		x.append(q[0])
		y.append(q[-1])
	a = sorted(x)[::-1]
	b = sorted(y)[::-1]
	if x != y:
		print('rated')
		return
	if a != b:
		print('rated')
		return
	if a != x or b != y:
		print('unrated')
		return
	else:
		print('maybe')
		return
t = 1
for hula in range(t):
	solve()


n = int(input())
rated = 0
unrated = 0
for i in range(n):
	(a, b) = list(map(int, input().strip().split(' ')))
	if i == 0:
		MIN = a
	if a != b:
		rated = 1
	elif i == 0:
		MIN = a
	elif a > MIN:
		if rated == 0:
			unrated = 1
	elif a < MIN:
		MIN = a
if rated == 1:
	print('rated')
elif unrated == 1:
	print('unrated')
else:
	print('maybe')


def solution():
	arr = []
	for _ in range(int(input())):
		(x, y) = (int(i) for i in input().split(' '))
		arr.append((x, y))
	m = float('inf')
	for (x, y) in arr:
		if x != y:
			print('rated')
			return
	for (x, y) in arr:
		if m < x:
			print('unrated')
			return
		else:
			m = x
	print('maybe')
solution()


n = int(input())
L = []
ans = 'maybe'
for _ in range(n):
	(a, b) = list(map(int, input().split()))
	L.append((a, b))
	if a != b:
		ans = 'rated'
		break
L1 = L[:]
L1.sort(reverse=True)
for i in range(len(L)):
	if L[i] != L1[i] and ans != 'rated':
		ans = 'unrated'
		break
print(ans)


n = int(input())
a = [0] * n
b = [0] * n
r = False
p = True
for i in range(n):
	(a[i], b[i]) = [int(s) for s in input().split()]
	if a[i] != b[i]:
		r = True
		break
b = a[:]
b.sort(reverse=True)
if a != b:
	p = False
if r:
	print('rated')
elif p:
	print('maybe')
else:
	print('unrated')


n = int(input())
data = []
notOrder = False
for _ in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		print('rated')
		exit(0)
	data.append(a)
if data == sorted(data, reverse=True):
	print('maybe')
else:
	print('unrated')


n = int(input())
a = [0] * n
b = [0] * n
r = [-1] * n
k = 0
p = 0
for i in range(n):
	(x, y) = map(int, input().split())
	a[i] = x
	b[i] = y
c = 0
for i in range(n):
	if a[i] != b[i]:
		c = -1
if c == -1:
	print('rated')
else:
	for i in range(n - 1):
		if a[i] < a[i + 1]:
			c = -2
	if c == -2:
		print('unrated')
	else:
		print('maybe')


flag1 = 0
flag2 = 0
last = 5000
n = int(input())
for i in range(n):
	(a, b) = map(int, input().strip().split())
	if a > last:
		flag2 = 1
	if a != b:
		flag1 = 1
	last = a
if flag1:
	print('rated')
elif flag2:
	print('unrated')
else:
	print('maybe')


n = int(input())
scores = []
for i in range(n):
	(a, b) = map(int, input().split())
	scores.append((a, b))
rated = False
unrated = False
for i in range(n - 1):
	(c, d) = scores[i]
	(e, f) = scores[i + 1]
	if d - c != 0 or f - e != 0:
		rated = True
		break
	elif d - c == 0 and f - e == 0 and (c < e):
		unrated = True
if rated:
	print('rated')
elif unrated:
	print('unrated')
else:
	print('maybe')


def func(old, new):
	for (o, n) in zip(old, new):
		if o != n:
			return 'rated'
	if old[::-1] == sorted(old):
		return 'maybe'
	return 'unrated'
n = int(input())
old = []
new = []
for _ in range(n):
	(o, n) = map(int, input().split())
	old.append(o)
	new.append(n)
print(func(old, new))


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')


import sys
r1 = []
r2 = []
n_participants = int(input())
for p in range(0, n_participants):
	participant = input().split()
	r1.append(int(participant[0]))
	r2.append(int(participant[1]))
for j in range(0, len(r2)):
	if r2[j] != r1[j]:
		print('rated')
		sys.exit(0)
for i in range(n_participants):
	for j in range(i):
		if r1[j] < r1[i]:
			print('unrated')
			sys.exit(0)
print('maybe')


n = int(input())
a = list(map(int, input().split()))
ischanged = a[0] != a[1]
issorted = True
for x in range(1, n):
	b = list(map(int, input().split()))
	ischanged = ischanged or b[0] != b[1]
	issorted = issorted and b[0] <= a[0] and (b[1] <= a[1])
	a = b
print('rated' if ischanged else 'unrated' if not issorted else 'maybe')


n = int(input())
forSort = []
counter = 0
for i in range(n):
	myMap = map(int, input().split())
	myMap = list(myMap)
	forSort.append(myMap[1])
	if myMap[0] == myMap[1]:
		counter += 1
	else:
		continue
temp = True
if n != counter:
	print('rated')
else:
	for i in range(len(forSort) - 1):
		if forSort[i] >= forSort[i + 1]:
			continue
		else:
			temp = False
			break
	print('unrated' if temp != True else 'maybe')


def cmp(l, k, t):
	c = 0
	for i in range(t):
		if l[i][0] == k[i][0]:
			c += 1
	if c == t:
		return True
t = int(input())
l = []
for i in range(t):
	s = list(map(int, input().split()))
	l.append(s)
count = 0
k = l.copy()
k.sort(reverse=True)
for i in range(t):
	if l[i][0] == l[i][1]:
		count += 1
if count != t:
	print('rated')
elif count == t:
	if cmp(l, k, t):
		print('maybe')
	else:
		print('unrated')


f = lambda : map(int, input().split())
n = int(input())
rt = []
c = 0
while n:
	(a, b) = f()
	if a != b:
		c = 1
	rt.append([a, b])
	n -= 1
if c == 1:
	print('rated')
else:
	print(['maybe', 'unrated'][rt[::-1] != sorted(rt)])


n = int(input())
a = {}
flag = []
k = []
for i in range(n):
	(ai, b) = input().split()
	ai = int(ai)
	b = int(b)
	l = (ai, b)
	a[i] = list(l)
	flag.append(a[i][1] - a[i][0])
	flg = [i for i in flag if i == 0]
	if a[i][1] - a[i][0] == 0:
		k.append(a[i][0])
k2 = k[:]
k1 = sorted(k2, reverse=True)
if len(flag) == len(flg):
	if k1 == k:
		print('maybe')
	else:
		print('unrated')
else:
	print('rated')


flag = 0
arr = []
for i in range(int(input())):
	(a, b) = map(int, input().split())
	arr.append(a)
	if b != a:
		flag = 1
if flag == 0:
	if arr == sorted(arr, reverse=True):
		flag = 2
if flag == 1:
	print('rated')
elif flag == 0:
	print('unrated')
elif flag == 2:
	print('maybe')


n = int(input())
rated = False
maybe = True
(first, prev) = map(int, input().split())
if first != prev:
	print('rated')
	exit()
for i in range(1, n):
	(a, b) = map(int, input().split())
	if a != b:
		rated = True
	if b > prev:
		maybe = False
	prev = b
if rated:
	print('rated')
elif maybe:
	print('maybe')
else:
	print('unrated')


n = int(input())
arr = []
prnt = ''
for i in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		prnt = 'rated'
		break
	arr.append(a)
else:
	revers = sorted(arr)
	revers.reverse()
	if arr == revers:
		prnt = 'maybe'
	else:
		prnt = 'unrated'
print(prnt)


n = []
a = 0
s = 0
z = int(input())
if 2 <= z <= 1000:
	for x in range(z):
		(c1, c2) = [int(b) for b in input().split()]
		n.append(c1)
		n.append(c2)
	d = int(len(n) / 2)
	for m in range(d):
		if n[a] != n[a + 1]:
			print('rated')
			s = s + 1
			break
		a += 2
	a = 0
	if s == 0:
		for f in range(d):
			if a > len(n) - 2:
				break
			elif n[a] > n[a - 2] and a >= 2:
				print('unrated')
				s = s + 1
				break
			a += 2
	if s == 0:
		print('maybe')


t = int(input())
array = []
rated = False
for i in range(t):
	inp = input().split(' ')
	x = int(inp[0])
	y = int(inp[1])
	if x != y:
		rated = True
		break
	array.append(x)
	array.append(y)
if rated:
	print('rated')
else:
	unrated = False
	for i in range(0, len(array) - 2, 2):
		if array[i] < array[i + 2]:
			unrated = True
			break
	if unrated:
		print('unrated')
	else:
		print('maybe')


n = int(input())
old = 0
unrated = 0
for i in range(n):
	(a, b) = list(map(int, input().split()))
	if a != b:
		print('rated')
		exit()
	else:
		if old != 0 and old < a:
			unrated = 1
		old = a
if unrated:
	print('unrated')
else:
	print('maybe')


def main():
	n = int(input())
	out_of_order = False
	current_max = 10000
	for _ in range(n):
		(a, b) = [int(r) for r in input().split()]
		if a != b:
			print('rated')
			return
		elif a > current_max:
			out_of_order = True
		current_max = a
	print('unrated' if out_of_order else 'maybe')
main()


n = eval(input())
i = 1
y = []
b = []
o = 'maybe'
while i <= n:
	a = list(map(int, input().split()))
	y += [a[0]]
	b += [a[1]]
	i += 1
i = 0
if y == b:
	while i < len(b) - 1 and o == 'maybe':
		if b[i] >= b[i + 1]:
			o = 'maybe'
		else:
			o = 'unrated'
		i += 1
else:
	o = 'rated'
print(o)


n = int(input())
val = []
for i in range(n):
	(b, a) = map(int, input().split())
	val.append(a)
	if b != a:
		print('rated')
		break
else:
	new = sorted(val)
	val.reverse()
	if val == new:
		print('maybe')
	else:
		print('unrated')


n = int(input())
a = [input().split() for i in range(n)]
cnt = 0
flag = 0
pre = 100000
for d in a:
	if d[0] == d[1]:
		if int(d[1]) > pre:
			flag = 1
	else:
		cnt += 1
	pre = int(d[0])
if cnt == 0:
	print('maybe' if flag == 0 else 'unrated')
else:
	print('rated')


li = [list(map(int, input().split())) for c in range(int(input()))]
for c in li:
	(x, y) = c
	if x != y:
		print('rated')
		break
else:
	ra = 'maybe'
	un = li[0][0]
	for c in li:
		x = c[0]
		if un >= x:
			un = x
		else:
			ra = 'unrated'
			break
	print(ra)


n = int(input())
prev = 0
changed = False
ordered = True
for _ in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		changed = True
	if prev != 0 and b > prev:
		ordered = False
	prev = b
if changed:
	print('rated')
elif not ordered:
	print('unrated')
else:
	print('maybe')


def solve():
	ratingsBef = []
	ratingsAft = []
	n = int(input())
	for _ in range(n):
		(old, new) = map(int, input().split())
		if old != new:
			return 'rated'
		ratingsBef.append(old)
		ratingsAft.append(new)
	for i in range(1, n):
		if ratingsBef[i] > ratingsBef[i - 1]:
			return 'unrated'
	return 'maybe'
print(solve())


n = int(input())
a = []
b = []
aim = 0
for i in range(n):
	s = list(map(int, input().strip().split()))
	a.append(s[0])
	b.append(s[1])
for i in range(n):
	if a[i] != b[i]:
		print('rated')
		aim = 1
		break
if aim == 0:
	for i in range(1, n):
		if b[i] > b[i - 1]:
			print('unrated')
			aim = 2
			break
if aim == 0:
	print('maybe')


n = int(input())
list1 = []
ans = 0
for i in range(n):
	(before, after) = map(int, input().split())
	list1.append((before, after))
for (before, after) in list1:
	if before != after:
		print('rated')
		ans = 1
		break
if ans == 0:
	if list1 == sorted(list1, reverse=True):
		print('maybe')
	else:
		print('unrated')


def mp():
	return map(int, input().split())

def lt():
	return list(map(int, input().split()))

def pt(x):
	print(x)

def ip():
	return input()

def it():
	return int(input())

def sl(x):
	return [t for t in x]

def spl(x):
	return x.split()

def aj(liste, item):
	liste.append(item)

def bin(x):
	return '{0:b}'.format(x)

def listring(l):
	return ' '.join([str(x) for x in l])

def ptlist(l):
	print(' '.join([str(x) for x in l]))
n = it()
(a, b) = ([], [])
for _ in range(n):
	(x, y) = mp()
	a.append(x)
	b.append(y)
if a != b:
	print('rated')
else:
	a.sort(key=lambda x: -x)
	if a == b:
		print('maybe')
	else:
		print('unrated')


rounds = int(input())
score = [input().split(' ') for i in range(rounds)]
before_score = [int(i[0]) for i in score]
after_score = [int(i[1]) for i in score]
change_in_score = len([i for i in range(rounds) if before_score[i] != after_score[i]])
if change_in_score >= 1:
	print('rated')
elif before_score != sorted(before_score)[::-1]:
	print('unrated')
else:
	print('maybe')


(l1, l2) = ([], [])
c = 0
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	l1.append(a)
	l2.append(b)
if l1 == l2:
	l = l1[:]
	l1.sort(reverse=True)
	for i in range(len(l)):
		if l[i] != l1[i]:
			print('unrated')
			c = 1
			break
	if c == 0:
		print('maybe')
else:
	print('rated')


t = int(input())
l = []
for _ in range(t):
	s = list(map(int, input().split()))
	if s[0] != s[1]:
		print('rated')
		quit()
	l.append(s[0])
j = sorted(l)[::-1]
if l != j:
	print('unrated')
else:
	print('maybe')


n = int(input())
check = []
for i in range(n):
	(x, y) = map(int, input().split())
	if x != y:
		print('rated')
		exit()
	check.append(x)
comp = sorted(check, reverse=True)
if comp == check:
	print('maybe')
else:
	print('unrated')


n = int(input())
w = set()
l = []
q = []
ans = ''
for i in range(n):
	(a, b) = map(int, input().split())
	l.append(a)
	if a != b:
		print('rated')
		exit()
	w.add(a)
else:
	q = l[:]
	q.sort(reverse=True)
	if q == l:
		print('maybe')
	else:
		print('unrated')


n = int(input())
(rated, unrated) = (False, False)
(mainL, copiedL) = ([], [])
for i in range(n):
	mainL.append(list(map(int, input().split())))
	if mainL[i][0] != mainL[i][1]:
		rated = True
	if mainL[i][0] > mainL[i - 1][0]:
		unrated = True
if rated:
	print('rated')
elif unrated:
	print('unrated')
else:
	print('maybe')


n = int(input())
isRated = False
l = []
while n:
	(b, a) = map(int, input().split())
	if a - b != 0:
		isRated = True
	else:
		l.append(b)
	n -= 1
if isRated:
	print('rated')
else:
	k = [x for x in l]
	k.sort(reverse=True)
	if l == k:
		print('maybe')
	else:
		print('unrated')


n = int(input())
before = []
after = []
flag = True
SecFlag = True
for i in range(n):
	(x, y) = input().split()
	before.append(x)
	after.append(y)
for i in range(n):
	if before[i] != after[i]:
		print('rated')
		SecFlag = False
		break
	elif i != 0 and int(before[i]) > int(before[i - 1]):
		flag = False
if flag == False and SecFlag == True:
	print('unrated')
elif flag == True and SecFlag == True:
	print('maybe')


n = int(input())
(f, l) = (0, [])
for i in range(n):
	(h, k) = map(int, input().split())
	l.append(h)
	if h != k:
		f = 1
l1 = list(l)
l.sort(reverse=True)
if f == 0:
	print(['unrated', 'maybe'][l1 == l])
else:
	print('rated')


prev = 10000
result = 'maybe'
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a != b:
		result = 'rated'
		break
	if a > prev:
		result = 'unrated'
	prev = a
print(result)


n = int(input())
a = []
b = []
change = 0
for _ in range(n):
	(u, v) = map(int, input().split())
	a.append(u)
	b.append(v)
	if u != v:
		change = 1
if change == 1:
	print('rated')
elif sorted(a, reverse=True) == b:
	print('maybe')
else:
	print('unrated')


N = int(input())
a1 = []
a2 = []
count1 = 0
count2 = 0
for i in range(N):
	(x, y) = map(int, input().split())
	a1.append(x)
	a2.append(y)
for b in range(len(a1)):
	if a1[b] == a2[b]:
		count1 += 1
a2.sort()
k = len(a2) - 1
for c in range(len(a2)):
	if a1[c] == a2[k]:
		count2 += 1
		k -= 1
if count1 != N:
	print('rated')
elif count2 == N and count2 == N:
	print('maybe')
else:
	print('unrated')


n = int(input())
(before, after) = ([], [])
for x in range(n):
	string = input()
	numbers = string.split()
	before.append(int(numbers[0]))
	after.append(int(numbers[1]))
condition = False
for x in range(n):
	if before[x] != after[x]:
		condition = True
		break
if condition:
	print('rated')
else:
	for x in range(n - 1):
		for y in range(x + 1, n):
			if after[x] < after[y]:
				condition = True
				break
	if condition:
		print('unrated')
	else:
		print('maybe')


last = 4127
p = False
for n in range(int(input())):
	(a, b) = map(int, input().split())
	if a != b:
		print('rated')
		break
	if a > last:
		p = True
	last = a
else:
	if p == True:
		print('unrated')
	else:
		print('maybe')


from sys import *
n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
	if l[i][0] != l[i][1]:
		print('rated')
		break
else:
	for i in range(n - 1):
		for j in range(i + 1, n):
			if l[i][0] < l[j][0]:
				print('unrated')
				exit()
	print('maybe')


n = int(input())
(x, y) = ([], [])
for i in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	y.append(b)
if x != y:
	print('rated')
	exit()
z = x[:]
z.sort()
z.reverse()
if x == y and z != y:
	print('unrated')
else:
	print('maybe')


n = int(input())
arr = []
for i in range(n):
	arr.append(list(map(int, input().split())))
inv = False
ch = False
for i in range(n):
	if arr[i][0] != arr[i][1]:
		print('rated')
		exit()
for i in range(1, n):
	if arr[i - 1][0] < arr[i][0]:
		inv = True
if inv:
	print('unrated')
else:
	print('maybe')


import sys
import math
import bisect
import itertools

def main():
	n = int(input())
	A = []
	B = []
	for i in range(n):
		(a, b) = map(int, input().split())
		A.append(a)
		B.append(b)
	if A != B:
		print('rated')
	elif A == sorted(A, reverse=True):
		print('maybe')
	else:
		print('unrated')
main()


n = int(input())
r = []
for i in range(n):
	(b, a) = map(int, input().split())
	r.append(a)
	if b != a:
		print('rated')
		break
else:
	x = sorted(r)
	r.reverse()
	if r == x:
		print('maybe')
	else:
		print('unrated')


n = int(input())
l1 = []
for _ in range(n):
	(i, f) = map(int, input().split())
	if f != i:
		print('rated')
		exit()
	l1.append(i)
l2 = [i for i in l1]
l2.sort(reverse=True)
if l2 == l1:
	print('maybe')
else:
	print('unrated')


n = int(input())
s = list()
d = list()
c = 0
for i in range(n):
	s += list(map(int, input().split()))
for i in range(0, n * 2, 2):
	if s[i] == s[i + 1]:
		c += 1
if c != n:
	print('rated')
else:
	for i in range(0, n * 2, 2):
		d.append(s[i])
	if d == sorted(d, reverse=True):
		print('maybe')
	else:
		print('unrated')


n = int(input())
s = []
for _ in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		print('rated')
		exit(0)
	s.append(a)
rs = sorted(s, reverse=True)
if s == rs:
	print('maybe')
else:
	print('unrated')


n = int(input())
matrix = []
for i in range(n):
	a = list(map(int, input().split()))
	matrix.append(a)
flag = 0
c = 0
for i in range(n):
	a = matrix[i][0]
	b = matrix[i][1]
	if a != b:
		flag = 1
		break
	if i - 1 >= 0:
		if a > matrix[i - 1][0] or b > matrix[i - 1][1]:
			c = 1
if flag == 1:
	print('rated')
elif c == 1:
	print('unrated')
else:
	print('maybe')


n = int(input())
l = d = 9 ** 9
c = 0
for _ in [0] * n:
	(a, b) = map(int, input().split())
	d &= a <= l
	l = a
	c += a != b
print([['', 'un'][c < 1] + 'rated', 'maybe'][d > 0 == c])


n = int(input())
la = []
lb = []
lab = []
for i in range(n):
	(a, b) = map(int, input().split())
	la.append(a)
	lb.append(b)
	lab.append((a, b))
flag = 0
for i in range(n):
	if la[i] != lb[i]:
		flag = 1
		break
if flag == 0:
	for i in range(n):
		if flag == -1:
			break
		for j in range(n):
			if i < j and la[i] < lb[j]:
				flag = -1
				break
if flag == 1:
	print('rated')
elif flag == -1:
	print('unrated')
else:
	print('maybe')


n = int(input())
changed = False
sorted = True
last = None
for _ in range(n):
	(ai, bi) = map(int, input().split())
	if ai != bi:
		changed = True
	if last is not None:
		if ai > last:
			sorted = False
	last = ai
if changed:
	print('rated')
elif not sorted:
	print('unrated')
else:
	print('maybe')


n = int(input())
ans = 'maybe'
s_last = float('inf')
for p in range(n):
	(s, e) = [int(x) for x in input().split(' ')]
	if s != e:
		ans = 'rated'
		break
	elif s_last < s:
		ans = 'unrated'
	s_last = s
print(ans)


from operator import itemgetter
n = int(input())
ai2 = 4126
flag = 0
flag2 = 0
for i in range(n):
	(ai, bi) = map(int, input().split())
	if ai != bi:
		flag2 = 1
	if ai > ai2:
		flag = 1
	ai2 = ai
if flag2 == 1:
	print('rated')
elif flag == 1:
	print('unrated')
else:
	print('maybe')


def calculate(old_ranking, new_ranking):
	if sum(old_ranking) != sum(new_ranking):
		return 'rated'
	else:
		for (o, n) in zip(old_ranking, new_ranking):
			if o != n:
				return 'rated'
		(min_index, min_rank) = (0, new_ranking[0])
		for (index, rank) in enumerate(new_ranking):
			if index > min_index and rank > min_rank:
				return 'unrated'
			else:
				min_index = index
				min_rank = rank
	return 'maybe'
n = int(input())
(old_ranking, new_ranking) = ([], [])
for i in range(n):
	[old, new] = input().split()
	[old, new] = [int(old), int(new)]
	old_ranking.append(old)
	new_ranking.append(new)
result = calculate(old_ranking, new_ranking)
print(result)


m = 4127
unrated = False
for _ in range(int(input())):
	(a, b) = map(int, input().split(' '))
	if a != b:
		print('rated')
		break
	if a <= m:
		m = a
	else:
		unrated = True
else:
	print('unrated' if unrated else 'maybe')


def solve():
	bef = []
	aft = []
	for i in range(int(input())):
		(a, b) = map(int, input().split())
		if a != b:
			print('rated')
			return
		bef.append(a)
		aft.append(b)
	if bef == sorted(bef, reverse=True):
		print('maybe')
		return
	else:
		print('unrated')
		return
solve()


n = int(input())
(r1, r2) = map(int, input().split())
ch = False
if r2 - r1 != 0:
	ch = True
c = 1
for x in range(1, n):
	(q1, q2) = map(int, input().split())
	if q2 - q1 != 0:
		ch = True
	elif r1 >= q1 and r2 >= q2:
		c += 1
	(r1, r2) = (q1, q2)
if ch:
	print('rated')
elif c == n:
	print('maybe')
else:
	print('unrated')


N = int(input())
A = []
B = []
for i in range(N):
	(a, b) = map(int, input().split())
	if a != b:
		print('rated')
		exit()
	A.append(a)
	B.append(b)
sorted_A = sorted(A, reverse=True)
for (a, sa) in zip(A, sorted_A):
	if a != sa:
		print('unrated')
		exit()
print('maybe')


N = int(input())
(L1, L2) = ([], [])
FLAG = 0
for i in range(N):
	(X, Y) = map(int, input().split())
	L1.append(X)
	L2.append(Y)
for i in range(N):
	if L1[i] != L2[i]:
		FLAG = 1
		print('rated')
		break
if FLAG == 0:
	x = 0
	Y = sorted(L1)
	for i in range(N):
		if Y[N - 1 - i] != L1[i]:
			x = 1
			print('unrated')
			break
	if x != 1:
		print('maybe')


n = int(input())
ratings = []
is_rated = False
for _ in range(n):
	(start, end) = [int(p) for p in input().split()]
	if start != end:
		is_rated = True
	ratings.append((start, end))
if is_rated:
	print('rated')
elif list(reversed(sorted(ratings, key=lambda x: x[0]))) == ratings:
	print('maybe')
else:
	print('unrated')


R = lambda : map(int, input().split())
(n,) = R()
rate = []
for i in range(n):
	(x, y) = R()
	if x != y:
		exit(print('rated'))
	rate.append(y)
if rate == sorted(rate, reverse=True):
	print('maybe')
else:
	print('unrated')


import sys
input = sys.stdin.readline
n = int(input().strip())
a = []
for _ in range(n):
	(n, m) = map(int, input().strip().split())
	if n != m:
		print('rated')
		exit(0)
	a.append([n, m])
a.reverse()
if a != sorted(a):
	print('unrated')
else:
	print('maybe')


import os
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from io import BytesIO, IOBase
from itertools import accumulate, combinations, combinations_with_replacement, groupby, permutations, product
from math import acos, asin, atan, ceil, cos, degrees, factorial, hypot, log2, pi, radians, sin, sqrt, tan
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits

def inp():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())

def main():
	n = inp()
	rated = False
	track = []
	for _ in range(n):
		(b, a) = invr()
		track.append(a)
		if b != a:
			rated = True
	if rated:
		print('rated')
	else:
		res = 'maybe'
		for i in range(1, n):
			if track[i] > track[i - 1]:
				res = 'unrated'
				break
		print(res)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


N = int(input().strip())
(a, b) = map(int, input().strip().split())
prev = (a, b)
changed = False if a == b else True
wrong_order = False
if not changed:
	for _ in range(N - 1):
		(a, b) = map(int, input().strip().split())
		if a != b:
			changed = True
			break
		if prev[0] < a:
			wrong_order = True
		prev = (a, b)
if changed:
	print('rated')
elif not changed and wrong_order:
	print('unrated')
else:
	print('maybe')


n = int(input())
(bef, res) = ([], '')
for i in range(n):
	(b, f) = list(map(int, input().split()))
	bef.append(b)
	if b != f:
		res = 'rated'
if res == '':
	for i in range(n - 1):
		if bef[i] < bef[i + 1]:
			res = 'unrated'
if res == '':
	res = 'maybe'
print(res)


s = [list(map(int, input().split())) for i in range(int(input()))]
if any((si[0] != si[1] for si in s)):
	print('rated')
elif any((s[i][0] < s[i + 1][0] for i in range(len(s) - 1))):
	print('unrated')
else:
	print('maybe')


n = int(input())
a = n * [0]
b = n * [0]
h = 0
for i in range(n):
	(a[i], b[i]) = [int(i) for i in input().split()]
	if a[i] != b[i]:
		print('rated')
		h = 1
		break
if h == 0:
	z = a[:]
	z.sort()
	z.reverse()
	if a == z:
		print('maybe')
	else:
		print('unrated')


n = int(input())
s = []
d = 1
for i in range(n):
	f = input().split()
	s.append(int(f[1]))
	if f[0] != f[1]:
		d = 0
if d == 0:
	print('rated')
if d == 1:
	g = s[:]
	g.reverse()
	s.sort()
	if g == s:
		print('maybe')
	else:
		print('unrated')


t = int(input())
changed = 0
inverted = 0
for x in range(t):
	l1 = [int(x) for x in input().split()]
	a = l1[0]
	b = l1[1]
	if not changed and a != b:
		changed = 1
	if x > 0:
		if not inverted and c < a or d < b:
			inverted = 1
	c = a
	d = b
if changed:
	print('rated')
elif not changed and inverted:
	print('unrated')
else:
	print('maybe')


import sys
from math import sqrt
input = lambda : sys.stdin.readline()

def Main():
	n = int(input())
	v = []
	for i in range(n):
		d = [0, 0]
		(d[0], d[1]) = map(int, input().split(' '))
		v.append(d)
	ans = 'maybe'
	min = 4127
	for i in range(n):
		if v[i][0] != v[i][1]:
			ans = 'rated'
			break
	if ans == 'maybe':
		for i in range(n):
			if i == 0:
				min = v[i][1]
			elif v[i][1] > v[i - 1][1]:
				ans = 'unrated'
				break
	print(ans)
Main()


n = int(input())
a = []
a1 = []
for i in range(n):
	(f, s) = list(map(int, input().split()))
	if f != s:
		print('rated')
		return
	a.append(s)
	a1.append(s)
a.sort()
if a[::-1] == a1:
	print('maybe')
	return
print('unrated')


a = [input().split() for i in range(int(input()))]
for i in a:
	if int(i[0]) != int(i[1]):
		print('rated')
		exit(0)
p = 9999
for i in a:
	if int(i[0]) > p:
		print('unrated')
		exit(0)
	p = int(i[0])
print('maybe')


n = int(input())
x = []
y = []
for i in range(n):
	s = input()
	s = s.split()
	x.append(int(s[0]))
	y.append(int(s[1]))
flag = 0
for i in range(n):
	if x[i] != y[i]:
		flag = 1
		break
	elif i > 0:
		if x[i] > x[i - 1]:
			flag = 2
if flag == 1:
	print('rated')
elif flag == 2:
	print('unrated')
else:
	print('maybe')


n = int(input())
q = [[int(x) for x in input().split()] for i in range(n)]
if any((x[0] != x[1] for x in q)):
	print('rated')
else:
	unrated = 0
	for i in range(n - 1):
		piv = q[i]
		for j in range(i + 1, n):
			temp = q[j]
			if piv < temp:
				unrated = 1
				break
		if unrated:
			break
	print('unrated' if unrated else 'maybe')


import sys
import os
if os.environ.get('DEBUGSTER_PYTHON'):
	sys.stdin = open('in.txt', 'r')
	sys.stdout = open('out.txt', 'w')
n = int(input())
before = list()
after = list()
rated = False
for i in range(n):
	(x, y) = map(int, input().split())
	before.append(x)
	after.append(y)
	if x != y:
		rated = True
if rated:
	print('rated')
else:
	unrated = False
	for i in range(n - 1):
		if before[i] < before[i + 1] or after[i] < after[i + 1]:
			unrated = True
			break
	if unrated:
		print('unrated')
	else:
		print('maybe')


a = []
for _ in range(int(input())):
	a.append(list(map(int, input().split())))
a = list(zip(*a))
if a[0] != a[1]:
	print('rated')
elif list(a[0]) == sorted(a[0], reverse=True):
	print('maybe')
else:
	print('unrated')


import sys

def solve():
	n = int(sys.stdin.readline())
	rats = [0] * n
	for i in range(n):
		(ai, bi) = map(int, sys.stdin.readline().split())
		if ai != bi:
			print('rated')
			return
		rats[i] = ai
	for i in range(n - 1):
		if rats[i] < rats[i + 1]:
			print('unrated')
			return
	print('maybe')
solve()


r = int(input())
(li, lj) = ([0] * r, [0] * r)
k = 1
for i in range(r):
	(li[i], lj[i]) = map(int, input().split())
	if li[i] != lj[i]:
		k = 0
if k:
	for i in range(1, r):
		if li[i] > li[i - 1]:
			k = -1
			break
if k == 0:
	print('rated')
elif k == -1:
	print('unrated')
else:
	print('maybe')


import sys

def solve():
	contestants_rating = []
	r = 'maybe'
	n = int(input())
	for i in range(0, n):
		string_rating = input().split(' ')
		rating_tuple = tuple(map(int, string_rating))
		contestants_rating.append(rating_tuple)
	for contestant_rating in contestants_rating:
		(rating_before, rating_after) = contestant_rating
		if rating_before != rating_after:
			print('rated')
			return
	sorted_contestant_ratings = sorted(contestants_rating, reverse=True, key=lambda x: x[0])
	if sorted_contestant_ratings != contestants_rating:
		print('unrated')
	else:
		print('maybe')
solve()


n = int(input())
results = []
for i in range(n):
	results.append([int(x) for x in input().split()])
for i in results:
	if i[0] != i[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')


n = input()
participants = []
rated = False
unrated = False
for i in range(int(n)):
	p = list(map(int, input().split()))
	if p[0] != p[1]:
		rated = True
	participants.append(p)
	if i > 0 and participants[i][0] > participants[i - 1][0]:
		unrated = True
if rated:
	print('rated')
elif unrated:
	print('unrated')
else:
	print('maybe')


lst = []
res = 0
n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	lst.append([a, b])
	if a != b:
		res += 1
new_lst = sorted(lst, reverse=True)
if res == 0:
	if new_lst == lst:
		print('maybe')
	elif new_lst != lst:
		print('unrated')
else:
	print('rated')


n = int(input())
rating = []
for i in range(0, n):
	rating.append(input().split())
collection = 0
for element in rating:
	if element[0] != element[-1]:
		collection += 1
	else:
		pass
expanded = []
counter_e = 0
for element in rating:
	for val in element:
		expanded.append(int(val))
comp = sorted(expanded, reverse=True)
if expanded != comp:
	counter_e += 1
if collection > 0:
	print('rated')
elif counter_e > 0 and collection == 0:
	print('unrated')
elif counter_e == 0 and collection == 0:
	print('maybe')


def ratedOrImp(t, n):
	for i in range(n):
		if t[i][0] != t[i][1]:
			return 'rated'
	newT = list(reversed(sorted(t)))
	for i in range(n):
		if newT[i][0] != t[i][0]:
			return 'unrated'
	return 'maybe'
n = int(input())
t = []
for _ in range(n):
	(a, b) = map(int, input().split())
	t.append((a, b))
print(ratedOrImp(t, n))


n = int(input())
rate = -1
last = -1
for i in range(n):
	(a, b) = (int(i) for i in input().split())
	if a != b:
		rate = 1
		break
	if a > last and last != -1 and (rate == -1):
		rate = 0
	last = a
if rate == 1:
	print('rated')
elif rate == 0:
	print('unrated')
else:
	print('maybe')


size_of_array = int(input())
a_ = []
b_ = []
for i in range(size_of_array):
	i = input()
	i = i.split(' ')
	a_.append(int(i[0]))
	b_.append(int(i[1]))
if a_ == b_ and a_ == sorted(a_, reverse=True):
	print('maybe')
elif a_ == b_:
	print('unrated')
else:
	print('rated')


n = int(input())
l1 = []
l2 = []
for i in range(n):
	(n1, n2) = map(int, input().split())
	l1.append(n1)
	l2.append(n2)
a = sorted(l1, reverse=True)
b = sorted(l2, reverse=True)
if l1 == l2:
	if l1 == a and l2 == b:
		print('maybe')
	else:
		print('unrated')
else:
	print('rated')


n = int(input())
rate = []
isRated = False
for i in range(n):
	(a, b) = list(map(int, input().split()))
	if a != b:
		isRated = True
		break
	rate.append(a)
if isRated:
	print('rated')
	exit()
else:
	isRated = True
	for i in range(len(rate) - 1):
		if rate[i] < rate[i + 1]:
			isRated = False
			break
	if isRated == True:
		print('maybe')
	else:
		print('unrated')


n = int(input())
l = []
z = []
t = []
count = 0
for i in range(n):
	(a, b) = map(int, input().split())
	l.append(a)
	z.append(b)
	if a == b:
		count += 1
l = sorted(l, reverse=True)
if count != n:
	print('rated')
elif z == l:
	print('maybe')
else:
	print('unrated')


descending = True
prev = 9999
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a != b:
		print('rated')
		break
	if a > prev:
		descending = False
	prev = a
else:
	print('maybe' if descending else 'unrated')


n = int(input())
ls = []
change = False
for i in range(n):
	p = list(map(int, input().split()))
	if p[0] != p[1]:
		change = True
	ls.append(p)
if change == True:
	print('rated')
elif ls != sorted(ls, reverse=True):
	print('unrated')
else:
	print('maybe')


from sys import stdin
input = stdin.readline
n = int(input())
change = 0
unordered = 0
c = float('inf')
for i in range(n):
	(a, b) = [int(x) for x in input().split()]
	if a != b:
		change = 1
		break
	elif c < a:
		unordered = 1
	c = a
if change:
	print('rated')
elif unordered:
	print('unrated')
else:
	print('maybe')


n = int(input())
sa = []
da = []
for x in range(n):
	(p, k) = list(map(int, input().split()))
	sa.append(p)
	da.append(k)
if sa != da:
	print('rated')
else:
	da.sort(reverse=True)
	if sa == da:
		print('maybe')
	else:
		print('unrated')


ln = int(input())
chng = 0
ord = 0
st = []
for _ in range(ln):
	part = list(map(int, input().split(' ')))
	if part[0] - part[1] != 0:
		chng = 1
	st.append(part[0])
if chng == 1:
	print('rated')
else:
	for j in range(0, ln - 1):
		if st[j] < st[j + 1]:
			ord = 1
	if ord == 1:
		print('unrated')
	else:
		print('maybe')


import sys
n = int(input())
kek = []
for i in range(n):
	(a, b) = (int(i) for i in input().split())
	kek.append(a)
	if a != b:
		print('rated')
		return
if kek == list(sorted(kek, reverse=True)):
	print('maybe')
else:
	print('unrated')


i = int(input())
flag7 = 0
l3 = []
res = 'maybe'
for d in range(0, i):
	(p, n) = map(int, input().strip().split())
	if p != n:
		res = 'rated'
		flag7 = 1
	l3.append([p, n])
	if len(l3) > 1 and flag7 != 1 and (l3[-1][0] > l3[-2][0]):
		res = 'unrated'
		flag7 = 2
print(res)


def main():
	ls = []
	flag = False
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		if a != b:
			flag = True
			break
		ls.append([a, b])
	new = sorted(ls, key=lambda x: x[0], reverse=True)
	if flag:
		print('rated')
	elif new == ls:
		print('maybe')
	else:
		print('unrated')
main()


arr1 = []
arr2 = []
for _ in range(int(input())):
	(a, b) = input().split()
	arr1.append(int(a))
	arr2.append(int(b))
n = len(arr1)

def isItRated(n, arr1, arr2):
	for i in range(0, n):
		if arr1[i] != arr2[i]:
			print('rated')
			return
	for i in range(1, n):
		if arr1[i] > arr1[i - 1]:
			print('unrated')
			return
	print('maybe')
isItRated(n, arr1, arr2)


n = int(input())
s = []
for _ in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		print('rated')
		break
	s.append(a)
else:
	rs = sorted(s)
	rs.reverse()
	if s == rs:
		print('maybe')
	else:
		print('unrated')


a = input()
a = int(a)
L = []
answ = 3
for i in range(a):
	L.append(input())
temp = 0
temp2 = 0
for i in range(a):
	(c, b) = L[i].split(' ')
	if c != b:
		temp = 1
for i in range(a - 1):
	(c, b) = L[i].split(' ')
	(e, d) = L[i + 1].split(' ')
	if int(c) < int(e):
		temp2 = 1
if temp == 1:
	print('rated')
elif temp2 == 1:
	print('unrated')
else:
	print('maybe')


d = []
f = 1
for i in range(int(input())):
	a = list(map(int, input().split()))
	if a[0] != a[1]:
		f = 0
	d.append(a[0])
if f == 0:
	print('rated')
else:
	d.reverse()
	p = d
	p = str(p)
	d.sort()
	s = str(d)
	if s == p:
		print('maybe')
	else:
		print('unrated')


a = int(input())
n1 = []
m1 = []
for i in range(a):
	(n, m) = map(int, input().split())
	n1.append(n)
	m1.append(m)
ans = 0
cnt = 1
i = 0
ra = 0
while i < a - 1:
	if n1[i] != m1[i]:
		ans = 1
		ra = 1
		print('rated')
		break
	elif n1[i] >= n1[i + 1]:
		cnt += 1
	i = i + 1
if n1[i] != m1[i] and ra != 1:
	ans = 1
	print('rated')
if cnt != a and ans == 0:
	print('unrated')
elif cnt == a and ans == 0:
	print('maybe')


n = int(input())
ls = []
res = ''
for i in range(n):
	ls.append(list(map(int, input().split())))
for i in range(n):
	if ls[i][0] != ls[i][1]:
		res = 'rated'
		break
if res != 'rated':
	for i in range(n - 1):
		if ls[i][1] < ls[i + 1][1]:
			res = 'unrated'
			break
		else:
			res = 'maybe'
print(res)


n = int(input())
M = [list(map(int, input().split())) for i in range(n)]
for i in range(n):
	if M[i][0] != M[i][1]:
		print('rated')
		exit()
if M[::-1] == sorted(M):
	print('maybe')
else:
	print('unrated')


n = int(input())
ratingHasChanged = False
perfectlySorted = True
first = []
second = []
for i in range(n):
	inp = input().split(' ')
	first.append(int(inp[0]))
	second.append(int(inp[1]))
	if first[i] != second[i]:
		ratingHasChanged = True
for i in range(1, len(first)):
	if first[i] > first[i - 1] or second[i] > second[i - 1]:
		perfectlySorted = False
		break
if ratingHasChanged == True:
	print('rated')
elif ratingHasChanged == False and perfectlySorted == False:
	print('unrated')
else:
	print('maybe')


import sys
n = int(input())
cng = back = confussion = 0
arr = []
for i in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		cng = 1
	arr.append(a)
if cng == 1:
	print('rated')
elif cng == 0:
	if arr == sorted(arr, reverse=True):
		print('maybe')
	else:
		print('unrated')


def is_changed(list1):
	for item in list1:
		if item[0] != item[1]:
			return True
	return False

def is_order(list1):
	highest = list1[0][0]
	for item in list1:
		if item[0] <= highest:
			highest = item[0]
		else:
			return False
	return True
n = int(input())
list1 = []
for x in range(n):
	list2 = [int(i) for i in input().split()]
	list1.append(list2)
if is_changed(list1):
	print('rated')
elif is_order(list1):
	print('maybe')
else:
	print('unrated')


n = int(input())
rates = [list(map(int, input().split())) for _ in range(n)]
output = ''
q = False
for i in range(n):
	z = q
	if rates[i][0] != rates[i][1]:
		output = 'rated'
		break
	elif i > 0:
		if rates[i - 1] < rates[i]:
			q = True
	if z != q:
		output = 'unrated'
if not output:
	print('maybe')
else:
	print(output)


def isRated(scores1, scores2):
	if scores1 != scores2:
		return 'rated'
	if sorted(scores1, reverse=True) == list(scores2):
		return 'maybe'
	else:
		return 'unrated'
nums = input()
scoresList1 = []
scoresList2 = []
for _ in range(int(nums)):
	items = input().split()
	scoresList1.append(int(items[0]))
	scoresList2.append(int(items[1]))
print(isRated(scoresList1, scoresList2))


n = int(input())
a = [0] * n
b = [0] * n
x = 0
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
for i in range(n):
	if a[i] != b[i]:
		print('rated')
		x = 1
		break
if x == 0:
	for i in range(n - 1):
		if a[i + 1] > a[i]:
			x = 1
			print('unrated')
			break
	if x == 0:
		print('maybe')


n = int(input())
a = []
b = []
while n > 0:
	(a1, b1) = map(int, input().split(' '))
	a.append(a1)
	b.append(b1)
	if a1 != b1:
		print('rated')
		exit()
	n -= 1
a1 = a[:]
a.sort(reverse=True)
if a == a1:
	print('maybe')
	exit()
print('unrated')


n = int(input())
m = 5000
res = ''
for _ in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		print('rated')
		exit()
	if a > m:
		res = 'unrated'
	m = min(a, m)
if res:
	print('unrated')
else:
	print('maybe')


c = True
(ok, e) = (0, 0)
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if _ == 0:
		ok = a
	if abs(b - a) > 0:
		e += 1
	if _ != 0:
		c = c and ok - a >= 0
		ok = a
if e != 0:
	print('rated')
elif c:
	print('maybe')
else:
	print('unrated')


p = []
c = 0
for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a != b:
		print('rated')
		c = 1
		break
	else:
		p.append(a)
if c == 0:
	if p != sorted(p, reverse=True):
		print('unrated')
	else:
		print('maybe')


n = int(input())
a = []
b = []
for i in range(n):
	(z, x) = map(int, input().split())
	a.append(z)
	b.append(x)
ans = 0
for i in range(n):
	if a[i] != b[i]:
		ans = 1
		break
if ans == 0:
	for i in range(1, n):
		if b[i] > b[i - 1]:
			ans = -1
			break
if ans == 1:
	print('rated')
elif ans == -1:
	print('unrated')
else:
	print('maybe')


l1 = []
l2 = []
f = 1
for i in range(int(input())):
	(x, y) = map(int, input().split())
	l1.append(x)
	l2.append(l2)
	if x != y:
		print('rated')
		f = 0
		break
if f:
	if list(reversed(sorted(l1))) == l1:
		print('maybe')
	else:
		print('unrated')


n = int(input())
a = []
cnt = 0
cnt2 = 0
tmp = 0
sc = 0
sc2 = 0
for i in range(n):
	row = input().split()
	for i in range(len(row)):
		row[i] = int(row[i])
	a.append(row)
while cnt < n:
	if a[cnt][0] < a[cnt][1] or a[cnt][0] > a[cnt][1]:
		print('rated')
		sc += 1
		sc2 += 1
		break
	cnt += 1
cnt2 = 0
if sc == 0:
	while cnt2 < n - 1:
		if a[cnt2][0] >= a[cnt2 + 1][0]:
			sc += 1
		cnt2 += 1
if sc == n - 1 and a[n - 2][0] >= a[n - 1][0] and (sc2 != 1):
	print('maybe')
elif sc2 != 1:
	print('unrated')


import sys
identical = []
for i in range(int(input())):
	(x, y) = map(int, input().split())
	if x != y:
		print('rated')
		sys.exit(0)
	else:
		identical.append(x)
if identical == list(sorted(identical, reverse=True)):
	print('maybe')
else:
	print('unrated')


import sys
n = int(sys.stdin.readline())
before = []
after = []
for _ in range(n):
	(b, a) = map(int, sys.stdin.readline().split())
	before.append(b)
	after.append(a)
if after != before:
	print('rated')
else:
	after.sort(reverse=True)
	if after == before:
		print('maybe')
	else:
		print('unrated')


n = int(input())
arr = []
for i in range(n):
	x = list(map(int, input().split()))
	arr.append(x)
c = True
for i in range(n):
	if arr[i][0] == arr[i][1]:
		pass
	else:
		c = False
if c:
	arr2 = []
	for i in range(n):
		arr2.append(arr[i][1])
	arr3 = sorted(arr2, reverse=True)
	if arr2 == arr3:
		print('maybe')
	else:
		print('unrated')
else:
	print('rated')


n = int(input())
prev = 2 ** 32
rated = -1
unrated = -1
while n > 0:
	(a, b) = map(int, input().split())
	if a != b:
		rated = 1
	else:
		if a > prev:
			unrated = 1
		prev = a
	if n == 1:
		if rated == 1:
			print('rated')
		elif unrated == 1:
			print('unrated')
		else:
			print('maybe')
	n -= 1


from sys import exit
n = int(input())
before = []
after = []
for i in range(n):
	(n, m) = map(int, input().split())
	before.append(n)
	after.append(m)
	if before[i] != after[i]:
		print('rated')
		exit()
if sorted(before, reverse=True) != before:
	print('unrated')
else:
	print('maybe')


n = int(input())
li_ini = []
li_fin = []
f = 0
for i in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		f = 1
	li_ini.append(a)
	li_fin.append(b)
if f:
	print('rated')
elif li_ini == sorted(li_ini, reverse=True):
	print('maybe')
else:
	print('unrated')


n = int(input())
m = []
for i in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		print('rated')
		exit()
	m.append(a)
	m.append(b)
k = sorted(m, reverse=True)
if k == m:
	print('maybe')
else:
	print('unrated')


n = int(input())
rank_before = []
rank_after = []
for _ in range(n):
	arr = list(map(int, input().split()))
	rank_before.append(arr[0])
	rank_after.append(arr[1])

def IsItRated(a, b):
	arr = sum([i - j for (i, j) in zip(a, b)])
	sorted_b = sorted(b, reverse=True)
	if a != b:
		return 'rated'
	elif b != sorted_b:
		return 'unrated'
	else:
		return 'maybe'
ans = IsItRated(rank_before, rank_after)
print(ans)


n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
flag = True
ans = 0
for i in range(1, n):
	if a[i][0] > a[i - 1][0]:
		flag = False
	if a[i][0] != a[i][1]:
		print('rated')
		ans = 1
		break
if ans == 0:
	if a[0][0] != a[0][1]:
		print('rated')
	elif flag == True:
		print('maybe')
	else:
		print('unrated')


n = int(input())
rates = []
for i in range(n):
	(before, after) = map(int, input().split())
	rates.append(before)
	if before != after:
		print('rated')
		exit(0)
print('maybe' if rates == list(reversed(sorted(rates))) else 'unrated')


____ = []
for _ in range(int(input())):
	__ = list(map(int, input().split()))
	if __[0] != __[1]:
		print('rated')
		exit(0)
	____.append(__[0])
print('maybe' if ____ == sorted(____, reverse=True) else 'unrated')


n = int(input())
a = list()
b = list()
for i in range(n):
	[x, y] = list(map(int, input().split()))
	a.append(x)
	b.append(y)
if a != b:
	print('rated')
	exit(0)
c = list(b)
c.sort(key=None, reverse=True)
if b == c:
	print('maybe')
else:
	print('unrated')


n = int(input())
flag = 0
f = 0
li = []
l = []
for i in range(n):
	(a, b) = [int(x) for x in input().split()]
	if b - a != 0:
		flag = 1
	li.append(a)
	l.append(a)
if flag == 1:
	print('rated')
else:
	c = 0
	l.sort(reverse=True)
	for i in range(len(li)):
		if li[i] != l[i]:
			c = 1
			break
	if c == 1:
		print('unrated')
	else:
		print('maybe')


from sys import stdin, stdout
import sys
import math

def get_int():
	return int(stdin.readline().strip())

def get_ints():
	return map(int, stdin.readline().strip().split())

def get_array():
	return list(map(int, stdin.readline().strip().split()))

def get_string():
	return stdin.readline().strip()

def op(c):
	return stdout.write(c)
n = get_int()
a = [0] * n
b = [0] * n
for i in range(n):
	(a[i], b[i]) = get_ints()
for i in range(n):
	if a[i] != b[i]:
		print('rated')
		break
else:
	c = sorted(a, reverse=True)
	if a == c:
		print('maybe')
	else:
		print('unrated')


n = int(input())
s = []
(c, r) = (0, 0)
for i in range(n):
	(a, b) = map(int, input().split())
	s.append((a, b))
for i in s:
	if i[0] != i[1]:
		c += 1
for i in range(n - 1):
	if s[i][0] < s[i + 1][0]:
		r += 1
if c != 0:
	print('rated')
elif r != 0:
	print('unrated')
else:
	print('maybe')


n = int(input())
g = 0
p = []
for i in range(n):
	(a, b) = list(map(int, input().split()))
	if a != b:
		g = 1
	p.append((a, b))
if g == 1:
	print('rated')
else:
	s = []
	s = s + p
	p.sort(key=lambda x: x[0], reverse=True)
	if s == p:
		print('maybe')
	else:
		print('unrated')


IL = lambda : list(map(int, input().split()))
I = lambda : int(input())
n = I()
ab = [IL() for i in range(n)]
if [i[0] for i in ab] != [i[1] for i in ab]:
	print('rated')
elif ab == sorted(ab, reverse=True):
	print('maybe')
else:
	print('unrated')


n = int(input())
flag = 0
l = []
for _ in range(n):
	(a, b) = map(int, input().split())
	l.append(a)
	if a != b:
		flag = 1
if flag:
	print('rated')
elif l == sorted(l, reverse=True):
	print('maybe')
else:
	print('unrated')


n = int(input())
a = [0 for i in range(n)]
b = [0 for i in range(n)]
y = 0
for i in range(0, n):
	p = input()
	p = p.split()
	x = [int(i) for i in p]
	a[i] = x[0]
	b[i] = x[1]
for i in range(0, n):
	if b[i] != a[i]:
		y = 1
		break
if y == 1:
	print('rated')
else:
	a.sort()
	for i in range(0, n):
		if b[i] != a[n - i - 1]:
			y = 1
			break
	if y == 1:
		print('unrated')
	else:
		print('maybe')


change = False
increase = False
last = 4127
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a != b:
		change = True
		break
	if b > last:
		increase = True
	last = b
if change:
	print('rated')
elif increase:
	print('unrated')
else:
	print('maybe')


n = int(input())
qq = []
pp = []
for i in range(n):
	l = list(map(int, input().split()))
	qq.append(l[0])
	pp.append(l[1])
if qq != pp:
	print('rated')
else:
	c = 0
	for j in range(1, len(qq)):
		if qq[j - 1] >= qq[j]:
			c += 1
	if c == n - 1:
		print('maybe')
	else:
		print('unrated')


def solve(arr):
	for i in arr:
		if i[0] != i[1]:
			return 'rated'
	for i in range(len(arr) - 1):
		if arr[i][0] < arr[i + 1][0]:
			return 'unrated'
	return 'maybe'

def main():
	n = int(input())
	arr = []
	for _ in range(n):
		i = list(map(int, input().split(' ')))
		arr.append(i)
	print(solve(arr))
main()


from sys import exit
n = int(input())
c = 0
r = 0
u = 0
while n > 0:
	(a, b) = map(int, input().split())
	if a > b or a < b:
		r = 1
	if c == 1 and a1 < a:
		u = 1
	a1 = a
	c = 1
	n -= 1
if r == 1:
	print('rated')
elif u == 1:
	print('unrated')
else:
	print('maybe')


f = 0
flag = 0
l = []
n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	l.append((a, b))
for i in range(n):
	if l[i][0] != l[i][1]:
		print('rated')
		exit()
for i in range(n):
	for j in range(i):
		if l[i][0] > l[j][0]:
			print('unrated')
			exit()
print('maybe')


(l, m) = ([], [])
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	l.append(a)
	if a != b:
		print('rated')
		exit()
	else:
		m.append(b)
m.sort(reverse=True)
if m == l:
	print('maybe')
else:
	print('unrated')


n = int(input())
l = []
for i in range(n):
	(a, b) = map(int, input().split())
	if a == b:
		l.append((a, b))
	else:
		print('rated')
		break
else:
	(a, b) = zip(*l)
	a = list(a)
	c = sorted(a, reverse=True)
	if a == c:
		print('maybe')
	else:
		print('unrated')


A = []
for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	A.append(a)
	if a != b:
		print('rated')
		exit()
B = sorted(A)
A.reverse()
if A == B:
	print('maybe')
else:
	print('unrated')


import copy
n = int(input())
rated = False
ratings = []
for i in range(n):
	rate = list(map(int, input().split()))
	if rate[0] != rate[1]:
		rated = True
	ratings.append(rate[0])
if rated:
	print('rated')
else:
	r = copy.copy(ratings)
	r.sort(reverse=True)
	if r == ratings:
		print('maybe')
	else:
		print('unrated')


def main():
	N = int(input())
	A = []
	B = []
	for n in range(N):
		(a, b) = map(int, input().split())
		A.append(a)
		B.append(b)
		if a != b:
			print('rated')
			return
	if sorted(A, reverse=True) != A:
		print('unrated')
	else:
		print('maybe')
main()


a = int(input())
i = 0
lst = []
j = 0
y = 0
u = 0
k = 0
for i in range(a):
	v = input().split()
	s = int(v[0])
	t = int(v[1])
	lst.append(s)
	lst.append(t)
r = 2 * a - 1
while j < r:
	w = lst[j]
	x = lst[j + 1]
	if w != x:
		y = y + 1
	j = j + 2
e = r - 1
while k < e:
	z = lst[k]
	q = lst[k + 2]
	if z < q:
		u = u + 1
	k = k + 2
if y > 0:
	print('rated')
elif u > 0:
	print('unrated')
else:
	print('maybe')


n = int(input())
b = []
b1 = []
for i in range(n):
	a = list(map(int, input().split()))
	b.append(a[0])
	b1.append(a[1])
if b == b1:
	c = list(b)
	c.sort()
	c = c[::-1]
	if c == b:
		print('maybe')
	else:
		print('unrated')
else:
	print('rated')


import math
n = int(input())
flag = 0
(z, x) = (4500, 4500)
for i in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		flag = 3
	elif a == b and a > z and (b > x) and (flag == 0):
		flag = 1
	z = a
	x = b
if flag == 0:
	print('maybe')
elif flag == 1:
	print('unrated')
elif flag == 3:
	print('rated')


n = int(input())
l = []
t = False
for i in range(n):
	(x, y) = map(int, input().split())
	if not x == y:
		t = True
	l.append(x)
if t:
	print('rated')
else:
	x = 4127
	for i in l:
		if x < i:
			print('unrated')
			exit()
		x = i
	print('maybe')


Z = int(input())
rate = []
for i in range(Z):
	(p, q) = map(int, input().split())
	if p != q:
		print('rated')
		exit()
	rate.append(q)
if rate == sorted(rate, reverse=True):
	print('maybe')
else:
	print('unrated')


z = int(input())
l = []
res = ''
while z:
	(a, b) = map(int, input().rstrip().split(' '))
	l.append([a, b])
	z = z - 1
o = [l[i][0] for i in range(len(l))]
z = o
o.sort(reverse=True)
if z == [l[i][0] for i in range(len(l))]:
	res = 'maybe'
else:
	res = 'unrated'
for i in l:
	if i[0] != i[1]:
		res = 'rated'
		break
print(res)


n = int(input())
found = 0
(ls1, ls2) = (list(), list())
for i in range(n):
	(x, y) = input().split()
	(x, y) = (int(x), int(y))
	if x != y:
		print('rated')
		found = 1
		break
	ls1.append(x)
if not found:
	ls2 = ls1.copy()
	ls2.sort()
	ls2.reverse()
	if ls1 == ls2:
		print('maybe')
	else:
		print('unrated')


from math import inf

def solve():
	global rates
	for (b, a) in rates:
		if b != a:
			return 'rated'
	for i in range(1, len(rates)):
		if rates[i - 1] < rates[i]:
			return 'unrated'
	return 'maybe'

def main():
	global rates
	n = int(input())
	rates = [list(map(int, input().split())) for _ in range(n)]
	print(solve())
main()


n = int(input())
li = []
ki = []
k = 0
for i in range(n):
	(a, b) = map(int, input().split())
	li.append(a)
	if a != b:
		k = 1
li = list(li)
if k == 0:
	print(['unrated', 'maybe'][li == sorted(li, reverse=True)])
else:
	print('rated')


tmp = 0
lst = []
for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	lst.append(a)
	lst.append(b)
	if a != b:
		print('rated')
		break
else:
	ok = False
	for i in range(len(lst) - 1):
		if lst[i] < lst[i + 1]:
			ok = True
			break
	if ok:
		print('unrated')
	else:
		print('maybe')


n = int(input())
list1 = []
list2 = []
for i in range(n):
	(a, b) = input().strip().split(' ')
	a = int(a)
	b = int(b)
	list1.append(a)
	list2.append(b)
cou = 0
for i in range(n):
	if list1[i] != list2[i]:
		print('rated')
		cou += 1
		break
if cou == 0:
	cou1 = 0
	for i in range(n - 1):
		if list1[i] < list1[i + 1]:
			cou1 += 1
			print('unrated')
			break
	if cou1 == 0:
		print('maybe')


def main():
	n = int(input())
	l = list((tuple(map(int, input().split())) for _ in range(n)))
	if all((a == b for (a, b) in l)):
		print(('maybe', 'unrated')[any((a[0] < b[0] for (a, b) in zip(l, l[1:])))])
	else:
		print('rated')
main()


t = int(input())
before = []
after = []
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	before.append(a)
	after.append(b)
if before == after and after != sorted(after)[::-1]:
	print('unrated')
elif before != after:
	print('rated')
else:
	print('maybe')


n = int(input())
data = [list(map(int, input().split())) for _ in range(n)]
x = any(map(lambda x: x[0] != x[1], data))
y = any(map(lambda x, y: x[0] < y[0], data, data[1:]))
if x:
	print('rated')
elif y:
	print('unrated')
else:
	print('maybe')


from sys import exit
n = int(input())
israted = False
notrated = False
(a, b) = ([], [])
for i in range(n):
	(x, y) = map(int, input().split())
	if x != y:
		print('rated')
		exit(0)
	a.append(x)
	b.append(y)
for i in range(n - 1):
	if a[i] < a[i + 1]:
		print('unrated')
		exit(0)
print('maybe')


n = int(input())
l = []
ch = 0
ch2 = 0
for i in range(0, n):
	l.append([int(x) for x in input().split()])
for i in range(0, n):
	if l[i][0] == l[i][1]:
		if i < n - 1 and l[i][0] >= l[i + 1][0]:
			ch = ch + 1
			ch2 = ch2 + 1
		elif l[i - 1][0] == l[i - 1][1]:
			ch = ch + 1
	else:
		ch = 0
		break
if ch and ch2 == n - 1:
	print('maybe')
elif ch:
	print('unrated')
else:
	print('rated')


x = int(input())
y = 0
flag = 0
flag1 = 0
list1 = []
list2 = []
while y < x:
	(score1, score2) = input().split()
	score1 = int(score1)
	score2 = int(score2)
	list1.append(score1)
	list2.append(score2)
	if score1 != score2:
		flag += 1
	y = y + 1
m = 1
while m < x:
	if list2[m] > list2[m - 1]:
		flag1 += 1
	m += 1
if flag != 0:
	print('rated')
elif flag == 0 and flag1 != 0:
	print('unrated')
else:
	print('maybe')


Help = float('inf')
unrate = False
for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a != b:
		print('rated')
		exit()
	elif a > Help:
		unrate = True
	else:
		Help = a
print('unrated' if unrate else 'maybe')


n = int(input())
rates = []
change = False
for i in range(n):
	(old, new) = map(int, input().split())
	rates.append(old)
	if old != new:
		change = True
if change:
	print('rated')
elif rates == sorted(rates, reverse=True):
	print('maybe')
else:
	print('unrated')


n = int(input())
a = []
b = []
for i in range(n):
	(x, y) = map(int, input().split())
	a.append(x)
	b.append(y)
c = a[:]
d = a[:]
c.sort(reverse=True)
d.sort(reverse=True)
if a == b:
	if c != a and d != b:
		print('unrated')
	else:
		print('maybe')
else:
	print('rated')


p1 = []
p2 = []
flag = 0
n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	if a == b:
		p1.append(a)
		p2.append(b)
		continue
	else:
		flag = 1
if flag == 1:
	print('rated')
else:
	for i in range(1, n):
		if p1[i] <= p1[i - 1]:
			continue
		else:
			flag = 1
	if flag == 1:
		print('unrated')
	else:
		print('maybe')


n = int(input())
rate = []
flag = 0
for i in range(n):
	(x, y) = map(int, input().split())
	if x != y:
		print('rated')
		flag = 1
		break
	rate.append(y)
if rate == sorted(rate, reverse=True) and flag == 0:
	print('maybe')
elif flag == 0:
	print('unrated')


n = int(input())
l = []
for _ in range(n):
	l.append([int(x) for x in input().split()])
c = 0
for i in l:
	a = set(i)
	if len(a) == 1:
		c += 1
if c != n:
	print('rated')
else:
	d = True
	for i in range(1, n):
		if l[i - 1][0] < l[i][0]:
			d = False
	if d == True:
		print('maybe')
	else:
		print('unrated')


d = []
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	d.append([a, b])
f = 0
for i in d:
	if abs(i[0] - i[1]) > 0:
		f = 1
		print('rated')
		break
if f == 0:
	if sorted(d, reverse=True) == d:
		print('maybe')
	else:
		print('unrated')


a = []
b = []
r = 0
c = 0
n = int(input())
for _ in range(n):
	(x, y) = map(int, input().split())
	a.append(x)
	b.append(y)
	if x != y:
		r = 1
	if x == y:
		c += 1
if r == 1:
	print('rated')
elif c == n:
	c = 0
	k = sorted(b, reverse=True)
	for i in range(n):
		if a[i] == k[i]:
			c += 1
	if c == n:
		print('maybe')
	else:
		print('unrated')


n = int(input())
a = n * [0]
flag = 0
for i in range(n):
	x = list(map(int, input().split()))
	if x[0] != x[1]:
		print('rated')
		flag = 1
		break
	a[i] = x
if flag == 0:
	for j in range(1, n):
		if a[j][0] > a[j - 1][0]:
			print('unrated')
			break
		if j == n - 1:
			print('maybe')


n = int(input())
r = 1
l = []
c = []
for i in range(n):
	mn = 0
	(x, y) = map(int, input().split())
	if x != y:
		r = 0
		break
	else:
		r = 1
		l.append(x)
		c.append(x)
c.sort()
if r == 0:
	print('rated')
elif c == l[::-1]:
	print('maybe')
else:
	print('unrated')


t = int(input())
x = []
y = []
flag = 0
for _ in range(t):
	(n, m) = map(int, input().split())
	if n != m:
		flag = 1
	x.append(n)
	y.append(m)
x.sort(reverse=True)
if flag == 1:
	print('rated')
elif flag == 0 and x == y:
	print('maybe')
else:
	print('unrated')


n = int(input())
(l1, l2) = ([], [])
for _ in range(n):
	(x, y) = [int(i) for i in input().split()]
	l1.append(x)
	l2.append(y)
if l1 == l2:
	if l1 == sorted(l1, reverse=True):
		print('maybe')
	else:
		print('unrated')
else:
	print('rated')


n = int(input())
t = 4127
p = 0
i = 0
r = ''
while i < n:
	(k, l) = map(int, input().split())
	if abs(k - l) != 0:
		r = 'rated'
		i = n
	elif t >= k:
		t = k
		i += 1
	else:
		p += 1
		i += 1
if r == 'rated':
	print(r)
elif p == 0:
	print('maybe')
else:
	print('unrated')


n = int(input())
(x, y) = (float('inf'), float('inf'))
rated = inc = False
for _ in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		rated = True
	if a > x or b > y:
		inc = True
	(x, y) = (a, b)
if rated:
	print('rated')
elif inc:
	print('unrated')
else:
	print('maybe')


n = int(input())
l = []
for i in range(n):
	l.append(list(map(int, input().split())))
for j in l:
	if j[0] != j[1]:
		print('rated')
		exit()
for m in range(n):
	for k in range(m):
		if l[m][0] > l[k][0]:
			print('unrated')
			exit()
print('maybe')


n = int(input())
change = 0
ordered = 1
p = 997979
q = 86949
while n > 0:
	x = input()
	x = x.split(' ')
	if int(x[0]) > p:
		ordered = 0
	p = int(x[0])
	q = int(x[1])
	if p != q:
		change = 1
	n -= 1
if change == 1:
	print('rated')
elif ordered == 0:
	print('unrated')
else:
	print('maybe')


n = int(input())
a = []
b = []
for _ in range(n):
	(ai, bi) = map(int, input().split())
	a.append(ai)
	b.append(bi)
tmp = 4126
cnt = 0
f = False
for i in range(n):
	if a[i] != b[i]:
		cnt += 1
	if tmp < a[i]:
		f = True
	tmp = a[i]
if 0 < cnt:
	ans = 'rated'
elif f:
	ans = 'unrated'
else:
	ans = 'maybe'
print(ans)


n = int(input())
lst = []
rated = False
for i in range(n):
	(before, after) = map(int, input().split())
	if before != after:
		rated = True
	lst.append((before, after))
if rated:
	print('rated')
elif sorted(lst, reverse=True) == lst:
	print('maybe')
else:
	print('unrated')


n = int(input())
l1 = []
l2 = []
for _ in range(n):
	(a, b) = map(int, input().split())
	l1.append(a)
	l2.append(b)
l3 = sorted(l1, reverse=True)
if l1 > l2 or l2 > l1:
	print('rated')
elif l1 == l3 and l1 == l2:
	print('maybe')
else:
	print('unrated')


(n, ans, c) = (int(input()), 'maybe', [99999999999999999])
for i in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		ans = 'rated'
		break
	if a > c[-1]:
		ans = 'unrated'
	c.append(a)
print(ans)


def main():
	x = int(input())
	z = 0
	unrated = False
	rated = False
	for i in range(0, x):
		y = input().split()
		a = int(y[0])
		b = int(y[1])
		if z == 0:
			z = a
		if a != b:
			rated = True
			break
		elif z < a:
			unrated = True
		z = a
	if rated == False:
		if unrated == True:
			print('unrated')
		else:
			print('maybe')
	else:
		print('rated')
main()


x = int(input())
z = 0
h = 0
n = []
p = []
while z < x:
	(a, b) = map(int, input().split())
	if a != b:
		h += 1
	n.append(a)
	p.append(a)
	z += 1
if h != 0:
	print('rated')
else:
	p.sort()
	p.reverse()
	if p == n:
		print('maybe')
	else:
		print('unrated')


n = int(input())
standings = []
for _ in range(n):
	(before, after) = map(int, input().split())
	standings.append((before, after))
for i in range(n):
	(b, a) = standings[i]
	if b != a:
		print('rated')
		break
else:
	prev = standings[0][0]
	for i in range(n):
		(b, a) = standings[i]
		if b > prev:
			print('unrated')
			break
		else:
			prev = b
	else:
		print('maybe')


def solve():
	n = int(input())
	l = [[0 for i in range(0, 2)] for j in range(0, n)]
	for i in range(0, n):
		(l[i][0], l[i][1]) = map(int, input().split())
	mini = l[0][0]
	f = 0
	if l[0][0] != l[0][1]:
		print('rated')
		return
	for i in range(1, n):
		if l[i][0] < mini:
			mini = l[i][0]
		if l[i][0] != l[i][1]:
			print('rated')
			return
		elif l[i][0] == l[i][1]:
			if l[i][0] > mini:
				f = 1
	if f:
		print('unrated')
		exit()
	print('maybe')
t = 1
while t:
	t -= 1
	solve()


import math
n = int(input())
isChanged = False
ans = 'maybe'
ass = [0, math.inf]
bss = [0, math.inf]
for i in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		ans = 'rated'
		isChanged = False
		break
	ass[i % 2] = a
	if ass[i % 2] > ass[(i + 1) % 2]:
		isChanged = True
if isChanged:
	ans = 'unrated'
print(ans)


n = int(input())
m = 4127
l = []
flag = 0
for i in range(n):
	(a, b) = map(int, input().split())
	l += [a]
	if a - b != 0:
		print('rated')
		exit()
	if min(l) < a:
		flag += 1
if flag > 0:
	print('unrated')
else:
	print('maybe')


n = int(input())
la = []
lb = []
for _ in range(n):
	(a, b) = map(int, input().split())
	la.append(a)
	lb.append(b)
if la != lb:
	print('rated')
else:
	la1 = la[:]
	lb1 = lb[:]
	la1.sort()
	lb1.sort()
	la1.reverse()
	lb1.reverse()
	if la1 == la and lb1 == lb:
		print('maybe')
	else:
		print('unrated')


n = int(input())
prev = (-1, -1)
maybe = True
is_rated = False
for i in range(n):
	(a, b) = list(map(int, input().split()))
	if a != b:
		is_rated = True
		break
	if prev[1] < b and prev[1] != -1:
		maybe = False
	prev = (a, b)
if is_rated:
	print('rated')
elif maybe:
	print('maybe')
else:
	print('unrated')


n = int(input())
l = []
for i in range(n):
	inp = input().split()
	l.append(inp)
isRated = 0
isUnrated = 0
for i in range(len(l)):
	if int(l[i][0]) != int(l[i][1]):
		isRated = 1
for i in range(len(l) - 1):
	if int(l[i][0]) < int(l[i + 1][0]):
		isUnrated = 1
if isRated == 1:
	print('rated')
elif isUnrated == 1:
	print('unrated')
else:
	print('maybe')


n = int(input())
a = [[int(x) for x in input().split()] for _ in range(n)]
if any([x - y for (x, y) in a]):
	print('rated')
else:
	a1 = sorted(a)
	a.reverse()
	if a == a1:
		print('maybe')
	else:
		print('unrated')


n = int(input())
a = []
b = []
s = 'maybe'
for i in range(n):
	(ai, bi) = input().split()
	a.append(ai)
	b.append(bi)
for i in range(n):
	if a[i] != b[i]:
		s = 'rated'
		break
if s != 'rated':
	for i in range(1, n):
		if int(a[i]) > int(a[i - 1]):
			s = 'unrated'
print(s)


n = int(input())
before = []
after = []
for i in range(n):
	(a, b) = map(int, input().split())
	before.append(a)
	after.append(b)
if before != after:
	print('rated')
elif before == sorted(before, reverse=True) or after == sorted(after, reverse=True):
	print('maybe')
else:
	print('unrated')


n = int(input())
res = ''
m = float('inf')
for i in range(n):
	s = list(map(int, input().split()))
	if s[0] != s[1]:
		res = 'r'
		break
	if s[0] < m:
		m = s[0]
	elif s[0] > m:
		res = 'u'
if res == 'r':
	print('rated')
elif res == 'u':
	print('unrated')
else:
	print('maybe')


t = int(input())
li = []
rating = []
for i in range(t):
	(a, b) = map(int, input().split())
	li.append(a - b)
	rating.append((a, b))
if any(li):
	print('rated')
else:
	j = rating + []
	j.sort()
	if j == rating[::-1]:
		print('maybe')
	else:
		print('unrated')


def is_rated(arr_before, arr_after):
	for line in range(n):
		if arr_before[line] != arr_after[line]:
			print('rated')
			return
	for i in range(n):
		for j in range(i, n):
			if arr_after[i] < arr_after[j]:
				print('unrated')
				return
	print('maybe')
	return
n = int(input())
(arr_before, arr_after) = ([], [])
for i in range(n):
	temp_list = list(map(int, input().split()))
	arr_before.append(temp_list[0])
	arr_after.append(temp_list[1])
is_rated(arr_after, arr_before)


n = int(input())
c = []
j = 0
for i in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		print('rated')
		exit()
	c.append(a)
for i in range(len(c) - 1):
	if c[i] < c[i + 1]:
		print('unrated')
		exit()
	else:
		j += 1
if j == n - 1:
	print('maybe')
	exit()


a = int(input())
b = []
for i in range(a):
	(c, d) = map(int, input().split())
	b.append(d)
	if c != d:
		print('rated')
		break
else:
	e = sorted(b)
	b.reverse()
	if e == b:
		print('maybe')
	else:
		print('unrated')


n = int(input())
(cur, pos) = (100000, 10000000)
f = []
rated = 0
for i in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		rated = 1
	f.append([a, b])
if rated:
	print('rated')
	exit(0)
for i in range(n):
	[a, b] = f[i]
	if cur < a:
		print('unrated')
		exit(0)
	cur = a
print('maybe')


n = int(input())
a = [int(100000000)]
b = [int(100000000)]
ans = []
i = 1
while i < n + 1:
	(m, p) = input().split()
	a.append(int(m))
	b.append(int(p))
	if a[i] != b[i]:
		ans.append('rated')
		i = i + 1
	elif a[i] > a[i - 1]:
		ans.append('unrated')
		i = i + 1
	elif a == b and i == n:
		ans.append('maybe')
		i = i + 1
	else:
		i = i + 1
if 'rated' in ans:
	print('rated')
else:
	print(ans[0])


n = int(input())
f = 0
pre = 0
for i in range(n):
	(a, b) = map(int, input().split())
	if pre < b and i != 0:
		f = 2
	pre = b
	if a != b:
		f = 1
		break
if f == 1:
	print('rated')
elif f == 2:
	print('unrated')
else:
	print('maybe')


n = int(input())
last = 10000000.0
srt_flg = True
for _ in range(n):
	(x, y) = map(int, input().split())
	if x > last:
		srt_flg = False
	if x != y:
		print('rated')
		break
	last = x
else:
	print('maybe' if srt_flg else 'unrated')


n = int(input())
l = [[*map(int, input().split())] for _ in range(n)]
a = b = False
cur = float('inf')
for (x, y) in l:
	a |= y - x != 0
	b |= cur < x
	cur = x
if a:
	print('rated')
elif b:
	print('unrated')
else:
	print('maybe')


import sys
n = int(input())
before = []
after = []
for i in range(0, n):
	(x, y) = [int(num) for num in input().split()]
	before.append(x)
	after.append(y)
for i in range(0, n):
	if before[i] != after[i]:
		print('rated')
		sys.exit()
for i in range(0, n - 1):
	if before[i + 1] > before[i]:
		print('unrated')
		sys.exit()
print('maybe')


N = int(input())
ls = []
for i in range(N):
	(a, b) = map(int, input().split())
	ls.append(a)
	if a != b:
		print('rated')
		break
else:
	if ls[::-1] == sorted(ls):
		print('maybe')
	else:
		print('unrated')