import sys input = sys.stdin.readline MOD = 998244353 n, m, _ = map(int, input().split()) edges = [[x - 1 for x in map(int, input().split())] for _ in [0] * _] st = set([]) for edge in edges: st |= set(edge) lis = list(st) di = { x : i for i, x in enumerate(lis)} t = len(lis) graph = [[0] * t for _ in [0] * t] for x, y in edges: graph[di[x]][di[y]] = 1 dp = [-1] * (1 << t) dp[0] = 1 def calc_dp(s): global dp if(dp[s] == -1): dp[s] = 0 for i in range(t): if not((s >> i) & 1): continue if all(i == j or not((s >> j) & 1) or graph[j][i] == 0 for j in range(t)): dp[s] += calc_dp(s - (1 << i)) dp[s] %= MOD return dp[s] p1 = p2 = p3 = 1 for i in range(t + 1, n + 1): if(i == n): p3 = p1 p1 *= i if(p1 < MOD): continue p1 %= MOD p2 = p3 * t % MOD if(t != n) else 1 ans = p1 * calc_dp((1 << t) - 1) % MOD for i in range(m): if(i in st): id = di[i] if any(id != j and graph[j][id] == 1 for j in range(t)): continue ans -= p2 * calc_dp((1 << t) - 1 - (1 << id)) % MOD else: ans -= p3 * calc_dp((1 << t) - 1) % MOD ans %= MOD print(ans)