#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int exp(int a, int b) {
if(!b) return 1;
return (1LL*exp(1LL*a*a%MOD,b>>1)*(b&1?a:1))%MOD;
}
/*
int dp[15][14][14][1<<14]; // how many sequences of length i, j pairs, last guy k, bitmask l
main() {
for(int n=1;n<14;n++) {
dp[0][0][n-1][0]=1;
for(int i=0;i<n;i++) for(int j=0;j<n;j++) for(int k=0;k<n;k++) for(int l=0;l<(1<<n);l++) for(int o=0;o<n;o++) if(!(l&(1<<o)) && j+(o==k+1)<n) {
dp[i+1][j+(o==k+1)][o][l|(1<<o)]+=dp[i][j][k][l];
if(dp[i+1][j+(o==k+1)][o][l|(1<<o)]>=MOD) dp[i+1][j+(o==k+1)][o][l|(1<<o)]-=MOD;
}
cout << "{";
int s = 0;
for(int j=0;j<n;j++)
for(int j=0;j<n;j++) cout<<dp[n][j]
}
}
main()
*/
vector<int> adj[15];
int fact[16];
main() {
fact[0]=1; for(int i=1;i<16;i++) fact[i]=(1LL*fact[i-1]*i)%MOD;
int n, m, k; cin >> n >> m >> k;
for(int i=0,x,y;i<m;i++) {cin>>x>>y;adj[x-1].push_back(y-1);}
int dp[1<<n]; fill(dp,dp+(1<<n),0); dp[0]=1;
for(int i=0;i<(1<<n);i++) for(int j=0;j<n;j++) if(!(i&(1<<j))){
bool ok = 1;
for(auto k: adj[j]) if(!(i&(1<<k))) ok=0;
if(ok) if((dp[i|(1<<j)]+=dp[i])>=MOD) dp[i|(1<<j)]-=MOD;
}
cout << (1LL*dp[(1<<n)-1]*exp(fact[n],MOD-2))<<"\n";
}