Problem: 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 ai and bi (1 ≤ ai, bi ≤ 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.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T>
T BigMod(T b, T p, T m) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    T s = BigMod(b, p / 2, m);
    return ((s % m) * (s % m)) % m;
  }
  return ((b % m) * (BigMod(b, p - 1, m) % m)) % m;
}
template <typename T>
T POW(T B, T P) {
  if (P == 0) return 1;
  if (P & 1)
    return B * POW(B, P - 1);
  else
    return POW(B, P / 2) * POW(B, P / 2);
}
template <typename T>
T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
int b2d(long long n) {
  int decimalNumber = 0, i = 0, remainder;
  while (n != 0) {
    remainder = n % 10;
    n /= 10;
    decimalNumber += remainder * pow(2, i);
    ++i;
  }
  return decimalNumber;
}
vector<long long> decToBinary(int n) {
  vector<long long> binaryNum(12);
  while (n > 0) {
    binaryNum.push_back(n % 2);
    n = n / 2;
  }
  reverse(binaryNum.begin(), binaryNum.end());
  return binaryNum;
}
int toInt(string s) {
  int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
long long toLlint(string s) {
  long long sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
bool isVowel(char ch) {
  ch = toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
template <class T>
string NTS(T Number) {
  stringstream ss;
  ss << Number;
  return ss.str();
}
bool isprime(int w) {
  if (w == 0) return false;
  if (w == 1) return false;
  int sqrtw = int(sqrt((double)w));
  for (int q = 2; q <= sqrtw; q++) {
    if (w % q == 0) return false;
  }
  return true;
}
const long long N = 1e6 + 1;
bitset<N + 1> bs;
vector<long long> prime;
void sieve() {
  bs.set();
  bs[0] = bs[1] = 0;
  for (long long i = 2; i < N; ++i) {
    if (bs[i]) {
      prime.push_back(i);
      for (long long j = i * i; j < N; j += i) bs[j] = 0;
    }
  }
  return;
}
void prime_divisor(long long n, long long q) {
  if (n % q)
    cout << n << "\n";
  else {
    long long nn = n;
    for (long long i = 1; i <= sqrt(n); i++) {
      if (n % i == 0) {
        {
          if ((n / i) % q != 0) {
            cout << n / i << "\n";
            break;
          }
        }
      }
    }
  }
}
unsigned long long fact(unsigned long long n) {
  if (n <= 1) return 1;
  return fact(n - 1) * n;
}
long long sumDigits(long long n) {
  long long sum = 0;
  while (n != 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main() {
  {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
  }
  long long n;
  cin >> n;
  vector<pair<long long, long long>> vx;
  long long yes = 0;
  for (long long i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    vx.push_back(make_pair(a, b));
    if (a != b) yes = 1;
  }
  if (yes == 1)
    cout << "rated"
         << "\n";
  else {
    bool yes = false;
    for (long long i = 0; i < vx.size() - 1; i++) {
      if (vx[i].first < vx[i + 1].first) {
        yes = true;
        break;
      }
    }
    if (yes)
      cout << "unrated"
           << "\n";
    else
      cout << "maybe"
           << "\n";
  }
}