#include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << '\n'; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << ' ' << H;
  debug_out(T...);
}
const int INF = 1e9;
const long long MOD = 1e9 + 7;
const int N = 3e5 + 5, SQ = 550;
int P[N];
vector<int> C[N];
vector<pair<int, int> > A[N];
int MAIN() {
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < q; i++) {
    int k;
    cin >> k;
    C[i].clear(), C[i].resize(k);
    for (int j = 0; j < k; j++) cin >> C[i][j], C[i][j]--;
  }
  memset(P, -1, sizeof P);
  for (int b = 0; b < q; b++)
    if ((int)(C[b].size()) > SQ) {
      for (int i = 0; i < (int)(C[b].size()); i++) P[C[b][i]] = i;
      for (int i = 0; i < q; i++)
        if ((int)(C[i].size()) <= SQ || i > b) {
          int mx = -1;
          for (int j = (int)(C[i].size()) - 1; j >= 0; j--) {
            int x = C[i][j];
            if (P[x] != -1 && P[x] < mx && C[b][P[x] + 1] != C[i][j + 1])
              return cout << "Human" << '\n', 0;
            mx = max(mx, P[x]);
          }
        }
      memset(P, -1, sizeof P);
    }
  for (int i = 0; i < n; i++) A[i].clear();
  for (int l = 0; l < q; l++)
    if ((int)(C[l].size()) <= SQ)
      for (int i = 0; i + 2 < (int)(C[l].size()); i++)
        for (int j = i + 2; j < (int)(C[l].size()); j++)
          A[C[l][i]].push_back(make_pair(C[l][i + 1], C[l][j]));
  for (int i = 0; i < n; i++) {
    for (pair<int, int> p : A[i])
      if (P[p.second] != -1 && P[p.second] != p.first)
        return cout << "Human" << '\n', 0;
      else
        P[p.second] = p.first;
    for (pair<int, int> p : A[i]) P[p.second] = -1;
  }
  cout << "Robot" << '\n';
  return 0;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  mt19937 Rnd(time(0));
  int t;
  cin >> t;
  while (t--) MAIN();
  return 0;
}
