#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000 * 1000 * 1000;
const long long LINF = INF * (long long)INF;
const int MAX = 300005;
const int mod = 1000 * 1000 * 1000 + 7;
const int MAGIC = 300;
vector<int> cities[MAX];
vector<pair<int, int> > adj[MAX];
int pos[MAX];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, q;
    cin >> n >> q;
    for (int i = 0; i < q; i++) {
      cities[i].clear();
      int cnt;
      cin >> cnt;
      for (int j = 0; j < cnt; j++) {
        int x;
        cin >> x;
        cities[i].push_back(x);
      }
    }
    bool human = false;
    for (int i = 0; i < q && !human; i++) {
      if (cities[i].size() > MAGIC) {
        memset(pos, -1, sizeof pos);
        for (int j = 0; j < cities[i].size(); j++) {
          pos[cities[i][j]] = j;
        }
        for (int j = 0; j < q; j++) {
          if (cities[j].size() <= MAGIC || j > i) {
            int mx = -1;
            for (int k = cities[j].size() - 1; k >= 0; k--) {
              int u = cities[j][k];
              if (pos[u] != -1 && mx > pos[u] &&
                  cities[i][pos[u] + 1] != cities[j][k + 1]) {
                if (!human) cout << "Human" << endl;
                human = true;
              }
              mx = max(mx, pos[u]);
            }
          }
        }
      }
    }
    if (!human) {
      for (int i = 0; i < n; i++) adj[i].clear();
      for (int i = 0; i < q; i++) {
        if (cities[i].size() <= MAGIC) {
          for (int j = 0; j < cities[i].size(); j++) {
            for (int k = j + 1; k < cities[i].size(); k++) {
              adj[cities[i][j]].push_back({cities[i][k], cities[i][j + 1]});
            }
          }
        }
      }
      for (int i = 0; i < n && !human; i++) {
        sort(adj[i].begin(), adj[i].end());
        for (int j = 1; j < adj[i].size(); j++) {
          if (adj[i][j].first == adj[i][j - 1].first &&
              adj[i][j].second != adj[i][j - 1].second) {
            if (!human) cout << "Human" << endl;
            human = true;
          }
        }
      }
    }
    if (!human) cout << "Robot" << endl;
  }
  return 0;
}
