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) def can_set_left(s, i): for x, y in edges: if(toposo_ids[y] != i): continue if((s >> toposo_ids[x]) & 1): 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)