#include <bits/stdc++.h>
using namespace std;
vector<int> c[300000], c2[300000];
pair<int, int> order[300000];
vector<pair<int, int> > occ[300000];
int last[300000], last2[300000], pos[300000];
int main() {
  int i, j;
  int t, n, q, k;
  scanf("%d", &t);
  while (t--) {
    scanf("%d %d", &n, &q);
    for (i = 0; i < q; i++) {
      scanf("%d", &k), c[i].resize(k);
      for (j = 0; j < k; j++) scanf("%d", &c[i][j]), c[i][j]--;
      order[i] = make_pair(k, i);
    }
    sort(order, order + q);
    for (i = 0; i < q; i++) c2[i] = c[order[i].second];
    for (i = 0; i < q; i++) c[i] = c2[i];
    long long int sum = 0;
    for (i = 0; i < q; i++) sum += c[i].size();
    long long int best = sum * q, sum2 = 0;
    int p = -1, bad = 0;
    for (i = 0; i < q; i++) {
      sum2 += (long long int)c[i].size() * (c[i].size() - 1) / 2;
      long long int x = sum2 + sum * (q - i - 1);
      if (x < best) best = x, p = i;
    }
    for (i = 0; i <= p; i++) {
      for (j = 0; j < c[i].size() - 1; j++)
        occ[c[i][j]].push_back(make_pair(i, j));
    }
    fill(last, last + n, -1);
    for (i = 0; i < n; i++) {
      sort(occ[i].begin(), occ[i].end());
      for (j = 0; j < occ[i].size(); j++) {
        int x = c[occ[i][j].first][occ[i][j].second + 1];
        for (k = occ[i][j].second + 1; k < c[occ[i][j].first].size(); k++) {
          int y = c[occ[i][j].first][k];
          if ((last[y] == i) && (last2[y] != x)) {
            bad = 1;
            break;
          }
          last[y] = i, last2[y] = x;
        }
        if (bad) break;
      }
      if (bad) break;
    }
    if (!bad) {
      for (i = p + 1; i < q; i++) {
        for (j = 0; j < c[i].size(); j++) pos[c[i][j]] = j + 1;
        for (j = 0; j < q; j++) {
          int e = c[i].size();
          for (k = 0; k < c[j].size(); k++) {
            if (pos[c[j][k]] != 0) {
              if ((k < c[j].size() - 1) && (pos[c[j][k]] < c[i].size()) &&
                  (c[j][k + 1] != c[i][pos[c[j][k]]]))
                e = min(e, pos[c[j][k]]);
              if (pos[c[j][k]] > e) {
                bad = 1;
                break;
              }
            }
          }
          if (bad) break;
        }
        for (j = 0; j < c[i].size(); j++) pos[c[i][j]] = 0;
        if (bad) break;
      }
    }
    printf(bad ? "Human\n" : "Robot\n");
    for (i = 0; i < n; i++) occ[i].clear();
  }
  return 0;
}
