#include <bits/stdc++.h>
using namespace std;
const int N = 300005;
int t, n, m, bb, cnt1, cnt2;
vector<pair<int, int>> v[N];
int c[N], s[N], len[N], st[N], ed[N], tt[N];
void solve() {
  for (int i = 1; i <= m; i++) {
    st[i] = cnt2 + 1;
    cin >> len[i];
    for (int j = 1; j <= len[i]; j++) cin >> s[++cnt2];
    ed[i] = cnt2;
  }
  bb = sqrt(cnt2);
  for (int i = 1; i <= m; i++)
    if (len[i] <= bb) {
      for (int j = st[i]; j <= ed[i]; j++)
        for (int k = j + 1; k <= ed[i]; k++)
          v[s[j]].push_back({s[k], s[j + 1]});
    } else {
      for (int j = st[i]; j <= ed[i]; j++) c[s[j]] = j;
      for (int j = 1; j <= m; j++) {
        if (j == i || (j < i && len[j] > bb)) continue;
        int vv = c[s[ed[j]]];
        for (int k = ed[j] - 1; k >= st[j]; --k) {
          if (!c[s[k]]) continue;
          if (vv > c[s[k]]) {
            if (s[c[s[k]] + 1] != s[k + 1]) {
              puts("Human");
              for (int j = st[i]; j <= ed[i]; j++) c[s[j]] = 0;
              return;
            }
          } else
            vv = c[s[k]];
        }
      }
      for (int j = st[i]; j <= ed[i]; j++) c[s[j]] = 0;
    }
  for (int i = 1; i <= n; i++) {
    for (auto &j : v[i]) {
      if (!tt[j.first])
        tt[j.first] = j.second;
      else if (tt[j.first] != j.second) {
        puts("Human");
        for (auto &k : v[i]) tt[k.first] = 0;
        return;
      }
    }
    for (auto &j : v[i]) tt[j.first] = 0;
  }
  puts("Robot");
}
int main() {
  ios::sync_with_stdio(false);
  int T;
  cin >> T;
  while (T--) {
    cin >> n >> m;
    solve();
    for (int i = 1; i <= n; i++) v[i].clear();
  }
  return 0;
}
