#include #include #include #include #include #include using namespace std; const int MAX_N = 1010; using bit = bitset; int main() { int n, m; cin >> n >> m; vector a(m), contain(n); for (int i = 0; i < m; i++) { int l; cin >> l; for (int j = 0; j < l; j++) { int v; cin >> v; v--; a[i][v] = 1; } } for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (a[j][i] == 1) { contain[i][j] = 1; } } } unordered_set sets; for (int i = 0; i < n; i++) { sets.insert(contain[i]); } int size = sets.size(); cout << atcoder::pow_mod(2, size, 998244353) << endl; return 0; }