#include using namespace std; const int nax = 1e5 + 5; void test_case() { int n, k; scanf("%d%d", &n, &k); vector> where(k, {0, 0}); for(int island = 1; island <= n; ++island) { int cnt; scanf("%d", &cnt); while(cnt--) { int x; scanf("%d", &x); --x; if(where[x].first == 0) where[x].first = island; else where[x].second = island; } } vector important(n + 1, false); for(pair & p : where) { if(p.first == 0) { puts("sad"); return; } if(p.second == 0) { // only one island has this ingredient important[p.first] = true; } } for(int i = 1; i <= n; ++i) if(!important[i]) { puts("some"); return; } puts("all"); } int main() { int T; scanf("%d", &T); for(int nr = 1; nr <= T; ++nr) test_case(); }