#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
const int sq = 500;
int t, n, q, pos[maxn + 100];
vector<int> path[maxn], h, l;
vector<pair<int, int> > vec[maxn];
bool solve() {
  for (auto posss : h) {
    auto &h = path[posss];
    fill(pos, pos + n + 100, -1);
    for (int i = 0; i < int(h.size()); i++) pos[h[i]] = i;
    for (int i = 1; i <= q; i++)
      for (int k = int(path[i].size()) - 1, j = path[i][k], mx = -1e9; k >= 0;
           k--, j = path[i][k])
        if (pos[j] != -1 and pos[j] < mx and path[i][k + 1] != h[pos[j] + 1])
          return (0);
        else
          mx = max(mx, pos[j]);
  }
  for (auto p : h) path[p].clear();
  for (auto v : l)
    for (int i = 0; i < int(path[v].size()); i++)
      for (int j = i + 1; j < int(path[v].size()); j++)
        vec[path[v][i]].push_back({path[v][j], path[v][i + 1]});
  for (auto p : l) path[p].clear();
  fill(pos, pos + n + 100, -1);
  for (int i = 1; i <= n; i++) {
    for (auto [f, s] : vec[i])
      if (pos[f] == -1)
        pos[f] = s;
      else if (pos[f] != s)
        return (0);
    for (auto [f, s] : vec[i]) pos[f] = -1;
  }
  return (1);
}
int32_t main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n >> q;
    h.clear(), l.clear();
    for (int i = 1; i <= q; i++) {
      int s;
      cin >> s;
      while (s--) {
        int x;
        cin >> x;
        path[i].push_back(x);
      }
      if (int(path[i].size()) <= sq)
        l.push_back(i);
      else
        h.push_back(i);
    }
    cout << (solve() ? "Robot" : "Human") << '\n';
    for (int i = 1; i <= n; i++) vec[i].clear();
    for (int i = 1; i <= q; i++) path[i].clear();
  }
  return (0);
}
