#include <bits/stdc++.h>
using namespace std;
const int N = 300005, SQ = 309;
int n, q, M[N];
vector<int> A[N];
vector<pair<int, int> > F[N];
void Solve() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) M[i] = -1, F[i].clear();
  for (int i = 1; i <= q; i++) {
    int len;
    scanf("%d", &len);
    A[i].clear();
    for (int j = 0, val; j < len; j++) scanf("%d", &val), A[i].push_back(val);
  }
  for (int i = 1; i <= q; i++)
    if ((int)A[i].size() <= SQ)
      for (int j = 0; j < (int)A[i].size(); j++)
        for (int h = j + 1; h < (int)A[i].size(); h++)
          F[A[i][j]].push_back({A[i][j + 1], A[i][h]});
  memset(M, -1, sizeof(M));
  for (int i = 1; i <= n; i++) {
    for (auto &X : F[i]) {
      if (M[X.second] != -1 && M[X.second] != X.first) {
        printf("Human\n");
        return;
      }
      M[X.second] = X.first;
    }
    for (auto &X : F[i]) M[X.second] = -1;
    F[i].clear();
  }
  for (int i = 1; i <= q; i++)
    if ((int)A[i].size() > SQ) {
      memset(M, -1, sizeof(M));
      for (int j = 0; j < (int)A[i].size(); j++) M[A[i][j]] = j;
      for (int j = 1; j <= q; j++) {
        if (i == j) continue;
        int Mx = -1;
        for (int h = (int)A[j].size() - 1; ~h; h--) {
          int k = A[j][h];
          if (M[k] != -1 && M[k] < Mx && A[i][M[k] + 1] != A[j][h + 1]) {
            printf("Human\n");
            return;
          }
          Mx = max(Mx, M[k]);
        }
      }
    }
  printf("Robot\n");
  return;
}
int main() {
  int test;
  scanf("%d", &test);
  while (test--) Solve();
  return (0);
}
