#include <bits/stdc++.h>
using namespace std;
const int N = 300005;
const int B = 605;
int n, Q, vis[N];
vector<int> v[N], vec[N];
bool solve() {
  scanf("%d%d", &n, &Q);
  for (int i = (int)(1); i <= (int)(n); i++) v[i].resize(0);
  for (int i = (int)(1); i <= (int)(Q); i++) {
    int x;
    scanf("%d", &x);
    vec[i].resize(x);
    for (auto &j : vec[i]) scanf("%d", &j);
    if (x <= B)
      for (auto j : vec[i]) v[j].push_back(i);
  }
  for (int i = (int)(1); i <= (int)(n); i++) {
    for (auto j : v[i])
      for (auto k : vec[j]) vis[k] = 0;
    for (auto j : v[i]) {
      int flag = 0;
      int sz = vec[j].size();
      for (int k = (int)(0); k <= (int)(sz - 1); k++)
        if (flag)
          if (!vis[vec[j][k]])
            vis[vec[j][k]] = vec[j][flag];
          else if (vis[vec[j][k]] != vec[j][flag])
            return 0;
          else
            ;
        else if (vec[j][k] == i)
          flag = k + 1;
    }
  }
  for (int i = (int)(1); i <= (int)(Q); i++)
    if (vec[i].size() > B) {
      for (int j = (int)(1); j <= (int)(n); j++) vis[j] = -1;
      for (int j = (int)(0); j <= (int)(vec[i].size() - 1); j++)
        vis[vec[i][j]] = j;
      for (int j = (int)(1); j <= (int)(Q); j++)
        if (j != i && (j > i || vec[j].size() > B)) {
          int mx = -1;
          for (int k = (int)(vec[j].size() - 1); k >= (int)(0); k--)
            if (vis[vec[j][k]] >= 0)
              if (vis[vec[j][k]] < mx)
                if (vec[i][vis[vec[j][k]] + 1] != vec[j][k + 1])
                  return 0;
                else
                  ;
              else
                mx = vis[vec[j][k]];
        }
    }
  return 1;
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) puts(solve() ? "Robot" : "Human");
}
