#include <bits/stdc++.h>
const int N = 300005;
const int B = 550;
std::vector<std::pair<int, int> > G[N];
std::vector<int> path[N];
int col[N];
int tim[N];
int S[N];
int n, m;
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= n; ++i) G[i].clear();
    bool flag = true;
    for (int i = 1; i <= m; ++i) {
      int k;
      scanf("%d", &k);
      path[i].clear();
      for (int j = 1; j <= k; ++j) {
        int x;
        scanf("%d", &x);
        path[i].push_back(x);
      }
    }
    for (int i = 1; i <= m; ++i) {
      int k = path[i].size();
      for (int j = 1; j <= k; ++j) S[j] = path[i][j - 1];
      S[k + 1] = 0;
      if (k >= B) {
        for (int i = 1; i <= k; ++i) tim[S[i]] = i;
        S[k + 1] = 0;
        for (int t = 1; t <= m; ++t) {
          if (t == i) continue;
          int now = k + 1;
          for (int j = 0; j < (int)path[t].size() - 1; ++j) {
            int x = path[t][j], nxt = path[t][j + 1];
            if (!tim[x]) continue;
            if (tim[x] > now) flag = false;
            if (S[tim[x] + 1] != nxt) now = tim[x];
          }
        }
        for (int i = 1; i <= k; ++i) tim[S[i]] = 0;
      } else {
        for (int i = 1; i < k; ++i) {
          for (int j = i + 1; j <= k; ++j) {
            G[S[i]].emplace_back(S[j], S[i + 1]);
          }
        }
      }
    }
    for (int u = 1; u <= n; ++u) {
      for (auto [v, w] : G[u]) {
        if (!col[v]) col[v] = w;
        if (col[v] != w) flag = false;
      }
      for (auto [v, w] : G[u]) col[v] = 0;
    }
    puts(flag ? "Robot" : "Human");
  }
  return 0;
}
