#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXVAL = 300000;
const int MAXROAD = 300000;
int nval, nroad;
vector<int> road[MAXROAD];
int biglim;
int big[MAXROAD], nbig;
int small[MAXROAD], nsmall;
int idx[MAXVAL];
vector<pair<int, int>> pos[MAXVAL];
int mark[MAXVAL], curmark;
int nxt[MAXVAL];
bool issurelyhuman() {
  biglim = 0;
  while (biglim * biglim <= nval) ++biglim;
  nbig = nsmall = 0;
  for (int i = (0); i < (nroad); ++i)
    if (((int)(road[i]).size()) >= biglim)
      big[nbig++] = i;
    else
      small[nsmall++] = i;
  for (int i = (0); i < (nbig); ++i) {
    int me = big[i];
    for (int k = (0); k < (nval); ++k) idx[k] = -1;
    for (int j = (0); j < (((int)(road[me]).size())); ++j) idx[road[me][j]] = j;
    for (int oth = (0); oth < (nroad); ++oth) {
      int common = -1;
      for (int j = ((int)(road[oth]).size()) - 1; j >= 0; --j) {
        int k = road[oth][j];
        if (idx[k] == -1) continue;
        if (common != -1 && idx[k] < common &&
            road[me][idx[k] + 1] != road[oth][j + 1])
          return true;
        if (common == -1 || idx[k] > common) common = idx[k];
      }
    }
  }
  for (int i = (0); i < (nsmall); ++i) {
    int me = small[i];
    for (int j = (0); j < (((int)(road[me]).size())); ++j)
      pos[road[me][j]].push_back(make_pair(me, j));
  }
  curmark = -1;
  for (int i = (0); i < (nval); ++i) mark[i] = -1;
  for (int i = (0); i < (nval); ++i) {
    ++curmark;
    for (int j = (0); j < (((int)(pos[i]).size())); ++j) {
      int me = pos[i][j].first, idx = pos[i][j].second;
      if (idx + 1 >= ((int)(road[me]).size())) continue;
      int want = road[me][idx + 1];
      for (int jj = (idx + 1); jj < (((int)(road[me]).size())); ++jj) {
        int k = road[me][jj];
        if (mark[k] != curmark) {
          mark[k] = curmark;
          nxt[k] = want;
        } else {
          if (nxt[k] != want) return true;
        }
      }
    }
  }
  return false;
}
void run() {
  scanf("%d%d", &nval, &nroad);
  for (int i = (0); i < (nroad); ++i) {
    int cnt;
    scanf("%d", &cnt);
    road[i] = vector<int>(cnt);
    for (int j = (0); j < (cnt); ++j) {
      int x;
      scanf("%d", &x);
      --x;
      road[i][j] = x;
    }
  }
  printf("%s\n", issurelyhuman() ? "Human" : "Robot");
  for (int i = (0); i < (nroad); ++i) road[i] = vector<int>();
  for (int i = (0); i < (nval); ++i) pos[i] = vector<pair<int, int>>();
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = (1); i <= (n); ++i) run();
  return 0;
}
