#include <bits/stdc++.h>
using namespace std;
const int K = 555;
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n;
    scanf("%d", &n);
    int q;
    scanf("%d", &q);
    vector<vector<int>> path(q);
    for (auto &p : path) {
      int k;
      scanf("%d", &k);
      p.resize(k);
      for (int i = 0; i < int(k); i++) scanf("%d", &p[i]), p[i]--;
    }
    bool ok = 1;
    vector<vector<pair<int, int>>> pre(n);
    for (auto &p : path) {
      int sz = p.size();
      if (sz < K) {
        for (int j = 0; j < int(sz); j++)
          for (int i = 0; i < int(j); i++)
            pre[p[i]].emplace_back(p[j], p[j - 1]);
      } else {
        int INF = n + 2;
        vector<int> pos(n, INF);
        for (int i = 0; i < int(sz); i++) pos[p[i]] = i;
        for (auto &q : path) {
          int mn = INF;
          for (int i = 0; i < int((int)q.size()); i++)
            if (pos[q[i]] < INF) {
              if (pos[q[i]] < mn)
                mn = pos[q[i]];
              else
                ok &= pos[q[i - 1]] + 1 == pos[q[i]];
            }
        }
      }
      if (!ok) break;
    }
    vector<pair<int, int>> last(n, make_pair(-1, -1));
    for (int i = 0; i < int(n); i++)
      for (auto vp : pre[i]) {
        if (!ok) goto hell;
        int v, p;
        tie(v, p) = vp;
        if (last[v].first == i && last[v].second != p) ok = 0;
        last[v].first = i;
        last[v].second = p;
      }
  hell:
    printf("%s\n", ok ? "Robot" : "Human");
  }
  return 0;
}
