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] def nPk(n, k): ret = 1 for i in range(n, n - k, -1): ret *= i ret %= MOD return ret ans = nPk(n, n - t) * calc_dp((1 << t) - 1) % MOD p1 = nPk(n - 1, n - t) p2 = nPk(n - 1, n - t - 1) 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 -= p1 * calc_dp((1 << t) - 1 - (1 << id)) % MOD else: ans -= p2 * calc_dp((1 << t) - 1) % MOD ans %= MOD print(ans)