#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y;
  bool operator==(const node& z) const { return x == z.x && y == z.y; }
};
struct node_hash {
  std::size_t operator()(const node& z) const { return z.x * 300000 + z.y; }
};
int t, _, n, i, j, u, q, v, k, tot = 0, vis[300005], dep[300005], st1, lst,
                               cnt[2], hd[2], sq;
const int inf = 1e9;
vector<int> s[2][300005];
unordered_map<node, int, node_hash> mp;
unordered_map<node, int, node_hash>::iterator it;
void insert(int p) {
  int i, x;
  cnt[p]++;
  for (i = 1; i <= k; i++) {
    scanf("%d", &x);
    s[p][cnt[p]].push_back(x);
  }
}
int follow(int p, int w) {
  int i, st1 = 0, lst = inf;
  for (i = 0; i < s[p][w].size(); i++) {
    if (vis[s[p][w][i]] < tot)
      st1 = 0;
    else {
      if (!st1 && lst < dep[s[p][w][i]]) return 1;
      st1 = 1;
      lst = dep[s[p][w][i]];
    }
  }
  return 0;
}
int main() {
  scanf("%d", &t);
  sq = 70;
  for (_ = 1; _ <= t; _++) {
    mp.clear();
    scanf("%d%d", &n, &q);
    for (i = 1; i <= q; i++) {
      scanf("%d", &k);
      if (k <= sq)
        insert(0);
      else
        insert(1);
    }
    for (i = hd[0] + 1; i <= cnt[0]; i++) {
      for (j = 0; j < s[0][i].size() - 1; j++) {
        for (v = j + 1; v < s[0][i].size(); v++) {
          it = mp.find((node){s[0][i][j], s[0][i][v]});
          if (it == mp.end())
            mp[(node){s[0][i][j], s[0][i][v]}] = s[0][i][j + 1];
          else if (it->second != s[0][i][j + 1]) {
            printf("Human\n");
            goto tag;
          }
        }
      }
    }
    for (i = hd[1] + 1; i <= cnt[1]; i++) {
      tot++;
      for (j = 0; j < s[1][i].size(); j++) {
        vis[s[1][i][j]] = tot;
        dep[s[1][i][j]] = j + 1;
      }
      for (j = hd[0] + 1; j <= cnt[0]; j++) {
        if (follow(0, j)) {
          printf("Human\n");
          goto tag;
        }
      }
      for (j = hd[1] + 1; j <= cnt[1]; j++) {
        if (follow(1, j)) {
          printf("Human\n");
          goto tag;
        }
      }
    }
    printf("Robot\n");
  tag:
    hd[0] = cnt[0];
    hd[1] = cnt[1];
  }
  return 0;
}
