#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
using namespace std;
const int N = 3e5 + 100, sq = 1000;
int vis[N];
vector<int> a[N];
vector<pair<int, int> > h[N];
int Main() {
  int n;
  cin >> n;
  int q;
  cin >> q;
  for (int i = 0; i <= max(q, n); i++) vis[i] = 0, h[i].clear(), a[i].clear();
  for (int i = 1; i <= q; i++) {
    int x;
    cin >> x;
    for (int j = 0; j < x; j++) {
      int y;
      cin >> y;
      a[i].push_back(y);
      if (x < sq) h[y].push_back({i, j});
    }
  }
  for (int i = 1; i <= q; i++) {
    if (a[i].size() >= sq) {
      for (int j = 0; j < a[i].size(); j++) {
        vis[a[i][j]] = j + 1;
      }
      for (int j = 1; j <= q; j++) {
        if (a[j].size() <= a[i].size()) {
          int p1 = -1, last = -1;
          vector<int> d;
          for (int k = 0; k < a[j].size(); k++) {
            if (vis[a[j][k]]) d.push_back(a[j][k]);
          }
          int p3 = 0;
          for (int i = 1; i < d.size(); i++)
            if (d[i] > d[i - 1]) p3 = 1;
          if (!p3) continue;
          for (int k = 0; k < a[j].size(); k++) {
            if (vis[a[j][k]]) {
              if (p1 == 0) return cout << "Human" << '\n', 0;
              ;
              if (last != -1 && last - vis[a[j][k]] > 1)
                return cout << "Human" << '\n', 0;
              ;
              last = vis[a[j][k]];
              p1 = 1;
            } else {
              if (p1 != -1) p1 = 0;
            }
          }
        }
      }
      for (auto j : a[i]) vis[j] = 0;
    }
  }
  for (int i = 1; i <= n; i++) {
    vector<int> f;
    for (auto u : h[i]) {
      int z = u.second;
      int x = u.first;
      if (z == 0) continue;
      int e = a[x][z - 1];
      for (int j = 0; j < z; j++) {
        int y = a[x][j];
        f.push_back(y);
        if (vis[y] != 0 && vis[y] != e) return cout << "Human" << '\n', 0;
        ;
        vis[y] = e;
      }
    }
    for (auto u : f) vis[u] = 0;
  }
  return cout << "Robot" << '\n', 0;
  ;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    Main();
  }
}
