#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
const long double PI = 3.14159265358979323846264338327;
template <typename T>
void unique(T &c) {
  std::sort(c.begin(), c.end());
  c.resize(std::unique(c.begin(), c.end()) - c.begin());
}
template <typename T>
void sort(T &c) {
  std::sort(c.begin(), c.end());
}
template <typename T>
T minV() {
  return std::numeric_limits<T>::min();
}
template <typename T>
T maxV() {
  return std::numeric_limits<T>::max();
}
template <typename T>
std::string tostr(const T &el) {
  std::stringstream stream;
  stream << el;
  return stream.str();
}
template <typename T>
T fromstr(const std::string &s) {
  T el;
  std::stringstream stream;
  stream << s;
  stream >> el;
  return el;
}
std::vector<std::string> &split(const std::string &s, const std::string &delim,
                                std::vector<std::string> &tokens) {
  std::string::size_type lastPos = s.find_first_not_of(delim, 0);
  std::string::size_type pos = s.find_first_of(delim, lastPos);
  while (std::string::npos != pos || std::string::npos != lastPos) {
    tokens.push_back(s.substr(lastPos, pos - lastPos));
    lastPos = s.find_first_not_of(delim, pos);
    pos = s.find_first_of(delim, lastPos);
  }
  return tokens;
}
std::string &join(const std::vector<std::string> &vs, const std::string &delim,
                  std::string &out) {
  for (std::string::size_type i = 0; i < vs.size() - 1; ++i)
    out += (vs[i] + delim);
  out += vs.back();
  return out;
}
std::vector<std::string> split(const std::string &s, const std::string &delim) {
  std::vector<std::string> tokens;
  std::string::size_type lastPos = s.find_first_not_of(delim, 0);
  std::string::size_type pos = s.find_first_of(delim, lastPos);
  while (std::string::npos != pos || std::string::npos != lastPos) {
    tokens.push_back(s.substr(lastPos, pos - lastPos));
    lastPos = s.find_first_not_of(delim, pos);
    pos = s.find_first_of(delim, lastPos);
  }
  return tokens;
}
std::string join(const std::vector<std::string> &vs, const std::string &delim) {
  std::string out;
  for (std::string::size_type i = 0; i < vs.size() - 1; ++i)
    out += (vs[i] + delim);
  out += vs.back();
  return out;
}
std::string &lower_case(std::string &s) {
  std::transform(s.begin(), s.end(), s.begin(), ::tolower);
  return s;
}
std::string &upper_case(std::string &s) {
  std::transform(s.begin(), s.end(), s.begin(), ::toupper);
  return s;
}
void nl() { std::cout << std::endl; }
template <typename T>
void out(const T &c) {
  for (typename T::const_iterator it = c.begin(); it != c.end(); ++it)
    std::cout << *it << " ";
}
int main() {
  int n;
  cin >> n;
  map<string, int> P;
  for (int i = 0; i < n; ++i) {
    string s;
    int p;
    cin >> s >> p;
    P[s] = max(P[s], p);
  }
  n = P.size();
  vector<pair<string, string> > ans;
  auto it = P.begin();
  while (it != P.end()) {
    auto it2 = P.begin();
    int better = 0;
    int worseeq = 0;
    while (it2 != P.end()) {
      if (it->second >= it2->second) ++worseeq;
      if (it->second < it2->second) ++better;
      ++it2;
    }
    if (100 * worseeq >= 99 * n) {
      ans.push_back(make_pair(it->first, "pro"));
    } else if (100 * worseeq >= 90 * n && 100 * better >= 1 * n) {
      ans.push_back(make_pair(it->first, "hardcore"));
    } else if (100 * worseeq >= 80 * n && 100 * better >= 10 * n) {
      ans.push_back(make_pair(it->first, "average"));
    } else if (100 * worseeq >= 50 * n && 100 * better >= 20 * n) {
      ans.push_back(make_pair(it->first, "random"));
    } else {
      ans.push_back(make_pair(it->first, "noob"));
    }
    ++it;
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); ++i)
    cout << ans[i].first << " " << ans[i].second << endl;
  return 0;
}
