import os import sys import numpy as np def solve(inp): N, K = inp[:2] G = np.zeros((K, N, N), dtype=np.int64) mod = 998244353 idx = 2 for i in range(K): tmp = inp[idx] idx += 1 for j in range(tmp): a, b = inp[idx:idx+2] idx += 2 G[i][a-1][b-1] += 1 G[i][b-1][a-1] += 1 dp = np.zeros((N+1, 1<