    #include <bits/stdc++.h>

 #define int long long
 using namespace std;

int a[10][10],w[10],l[10];
int n;
int ans;
void dfs(int nokori){
//	cout<<nokori<<endl;
	for(int i=1;i<=n;i++){
		if(w[i]>n/2 || l[i]>n/2)return;
	}
	
	if(nokori==0){
		ans++;
		return ;
	}
	
	for(int i=1;i<=n;i++)for(int j=i+1;j<=n;j++)if(a[i][j]==0){
		a[i][j]=1;
		a[j][i]=-1;
		w[i]++;
		l[j]++;
		if(w[i]<=n/2 && l[j]<=n/2)dfs(nokori-1);
		a[i][j]=0;
		a[j][i]=0;
		w[i]--;
		l[j]--;
		
		
		a[i][j]=-1;
		a[j][i]=1;
		w[j]++;
		l[i]++;
		if(w[j]<=n/2 && l[i]<=n/2)dfs(nokori-1);
		a[i][j]=0;
		a[j][i]=0;
		w[j]--;
		l[i]--;
		
		return;
	}
	
	return;
}


void solve(){
cin>>n;
	if(n==0) exit(0);
	//cout<<" "<<n<<endl;
	for(int i=0;i<10;i++){
		for(int j=0;j<10;j++)a[i][j]=0;
		w[i]=0;
		l[i]=0;
	}
	ans=0;
	int m;
	cin>>m;
	for(int i=0;i<m;i++){
		int y,yy;
		cin>>y>>yy;
		a[y][yy]=1;
		a[yy][y]=-1;
		w[y]++;
		l[yy]++;
	}
	
	int allnum=n*(n-1)/2-m;
	
	dfs(allnum);
cout<<ans<<endl;
}

    signed main(){
               cin.tie(0);
    		ios::sync_with_stdio(false);

    int t;
    	//cin>>t;
    	for(int i=0;;i++){
    		solve();
    	
    	}
    	return 0;
    	
            }
