import sys input = sys.stdin.readline MOD = 998244353 def nPk(n, k): ret = 1 for i in range(n, n - k, -1): ret *= i ret %= MOD return ret N, M, K = map(int, input().split()) edges = [[x - 1 for x in map(int, input().split())] for _ in [0] * K] toposo_st = set([]) for edge in edges: toposo_st |= set(edge) toposo_ids = { x : i for i, x in enumerate(toposo_st)} t = len(toposo_st) graph = [[0] * t for _ in [0] * t] for x, y in edges: graph[toposo_ids[x]][toposo_ids[y]] = 1 def can_set_left(s, i): for j in range(t): if(i == j or not((s >> j) & 1)): continue if(graph[j][i] == 0): continue return False return True dp = [-1] * (1 << t) dp[0] = 1 def count_toposo(s): global dp if(dp[s] == -1): dp[s] = 0 for i in range(t): if not((s >> i) & 1): continue if(can_set_left(s, i)): dp[s] += count_toposo(s - (1 << i)) dp[s] %= MOD return dp[s] ans = 0 p1 = nPk(N - 1, N - t) p2 = nPk(N - 1, N - t - 1) for i in range(M, N): if(i in toposo_st): id = toposo_ids[i] if not(can_set_left((1 << t) - 1, id)): continue ans += p1 * count_toposo((1 << t) - 1 - (1 << id)) % MOD else: ans += p2 * count_toposo((1 << t) - 1) % MOD ans %= MOD print(ans)