#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const int Max = 3e5 + 10;
const int Sq = 300;
vector<int> A[Max];
vector<pair<int, int>> vec[Max];
int tmp[Max];
int P[Max];
void solve() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) A[i].clear();
  for (int i = 1; i <= n; i++) vec[i].clear();
  for (int i = 1; i <= m; i++) {
    int cnt;
    cin >> cnt;
    A[i].resize(cnt + 1);
    for (int j = 1; j <= cnt; j++) cin >> A[i][j];
  }
  bool ok = 1;
  for (int i = 1; i <= m; i++) {
    if (A[i].size() >= Sq) {
      for (int j = 1; j <= n; j++) P[j] = 0;
      for (int j = 1; j < A[i].size(); j++) P[A[i][j]] = j;
      for (int j = 1; j <= m; j++) {
        int mx = 0;
        for (int k = A[j].size(); --k;) {
          int a = A[j][k];
          if (P[a] && P[a] < mx && k < A[j].size() - 1 &&
              P[a] < A[i].size() - 1) {
            ok &= A[j][k + 1] == A[i][P[a] + 1];
          }
          mx = max(mx, P[a]);
        }
      }
    }
  }
  for (int i = 1; i <= m; i++) {
    if (A[i].size() < Sq)
      for (int j = 1; j < A[i].size(); j++)
        for (int k = j + 2; k < A[i].size(); k++)
          vec[A[i][j]].push_back(make_pair(A[i][k], A[i][j + 1]));
  }
  for (int i = 1; i <= n; i++) {
    vector<int> toerr;
    for (pair<int, int> x : vec[i]) {
      if (tmp[x.first] == 0) tmp[x.first] = x.second, toerr.push_back(x.first);
      ok &= tmp[x.first] == x.second;
    }
    for (int x : toerr) tmp[x] = 0;
  }
  if (ok)
    cout << "Robot\n";
  else
    cout << "Human\n";
}
int main() {
  int q;
  cin >> q;
  while (q--) {
    solve();
  }
}
