#include <bits/stdc++.h>
using namespace std;
const int maxN = 3e5 + 5;
const int SQ = 550;
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
bool flag;
int l[maxN], pt[maxN];
vector<int> P[maxN];
vector<pair<int, int> > Q[maxN];
int main() {
  time_t START = clock();
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T;
  scanf("%d", &T);
  while (T--) {
    int n, q;
    scanf("%d%d", &n, &q);
    flag = false;
    for (int i = 0; i < q; i++) {
      scanf("%d", l + i);
      for (int inp, j = 0; j < l[i]; j++) {
        scanf("%d", &inp);
        P[i].push_back(inp);
      }
    }
    for (int i = 0; i < q; i++) {
      if (l[i] >= SQ) {
        memset(pt, -1, sizeof pt);
        for (int j = 0; j < l[i]; j++) pt[P[i][j]] = j;
        for (int j = 0; j < q; j++)
          if (l[j] <= SQ || j > i) {
            int mx = 0;
            for (int k = l[j] - 1; k > -1; k--) {
              if (pt[P[j][k]] != -1 && mx > pt[P[j][k]] &&
                  P[j][k + 1] != P[i][pt[P[j][k]] + 1])
                flag = true;
              mx = max(mx, pt[P[j][k]]);
            }
          }
      } else
        for (int lt = 0; lt < l[i]; lt++)
          for (int rt = lt + 1; rt < l[i]; rt++)
            Q[P[i][lt]].push_back({P[i][rt], P[i][lt + 1]});
    }
    memset(pt, -1, sizeof pt);
    for (int i = 1; i <= n; i++) {
      for (pair<int, int> pp : Q[i]) {
        if (pt[pp.first] != -1 && pt[pp.first] != pp.second) flag = true;
        pt[pp.first] = pp.second;
      }
      for (pair<int, int> pp : Q[i]) pt[pp.first] = -1;
    }
    printf(flag ? "Human\n" : "Robot\n");
    for (int i = 0; i <= max(q, n); i++) {
      P[i].clear();
      Q[i].clear();
    }
  }
  time_t FINISH = clock();
  cerr << "Execution time: "
       << (long double)(FINISH - START) / CLOCKS_PER_SEC * 1000.0
       << " milliseconds.\n";
  return 0;
}
