#include <bits/stdc++.h>
using namespace std;
int t;
int n, q;
vector<int> vi[300005];
bool used[300005];
int pre[300005];
vector<pair<int, int> > pos[300005];
int poss[300005];
int main() {
  cin >> t;
  while (t--) {
    scanf("%d%d", &n, &q);
    for (int i = 0; i < q; i++) vi[i].clear();
    for (int i = 1; i <= n; i++) {
      pre[i] = -1;
      used[i] = 0;
      pos[i].clear();
    }
    for (int i = 0; i < q; i++) {
      int k;
      scanf("%d", &k);
      for (int j = 0; j < k; j++) {
        int a;
        scanf("%d", &a);
        vi[i].push_back(a);
      }
    }
    bool answer = 0;
    for (int i = 0; i < q; i++) {
      if (vi[i].size() < 614) continue;
      for (int x = 0; x < vi[i].size(); x++) used[vi[i][x]] = 1;
      for (int x = 0; x < vi[i].size(); x++) poss[vi[i][x]] = x;
      for (int x = 0; x < vi[i].size(); x++)
        if (x) pre[vi[i][x]] = vi[i][x - 1];
      for (int j = 0; j < q; j++) {
        if (i == j) continue;
        bool in = 0;
        int prre = 1000000000;
        for (int k = 0; k < vi[j].size(); k++) {
          if (used[vi[j][k]]) {
            if (in) {
              int need = pre[vi[j][k]];
              int real = vi[j][k - 1];
              if (need != real && prre < poss[vi[j][k]]) {
                puts("Human");
                answer = 1;
                goto end;
              }
            }
            in = 1;
            prre = min(prre, poss[vi[j][k]]);
          }
        }
      }
      for (int x = 0; x < vi[i].size(); x++) used[vi[i][x]] = 0;
      for (int x = 0; x < vi[i].size(); x++)
        if (x) pre[vi[i][x]] = -1;
    }
  end:;
    if (answer) continue;
    for (int i = 0; i < q; i++) {
      if (vi[i].size() >= 614) continue;
      for (int x = 0; x < vi[i].size(); x++) {
        pos[vi[i][x]].push_back(make_pair(i, x));
      }
    }
    for (int beg = 1; beg <= n; beg++) {
      for (int i = 0; i < pos[beg].size(); i++) {
        int id = pos[beg][i].first;
        int nm = pos[beg][i].second;
        for (int j = nm + 1; j < vi[id].size(); j++) {
          int cur = vi[id][j];
          int prre = vi[id][j - 1];
          if (pre[cur] == -1) {
            pre[cur] = prre;
          } else if (pre[cur] != prre) {
            puts("Human");
            answer = 1;
            goto end2;
          }
        }
      }
      for (int i = 0; i < pos[beg].size(); i++) {
        int id = pos[beg][i].first;
        int nm = pos[beg][i].second;
        for (int j = nm + 1; j < vi[id].size(); j++) {
          int cur = vi[id][j];
          pre[cur] = -1;
        }
      }
    }
  end2:;
    if (answer) continue;
    puts("Robot");
  }
}
