#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
#define inf 1e9

vector<vector<int> > wl;
vector<int> wn;
int n;
int cnt;
void dfs(int x,int y){
 //   cout<<x<<' '<<y<<endl;
    if( x== n-1 && y == n ){
	if( wn[x] == 0 ) cnt++;
	 return;
    }
    if( x== y ){
	dfs(x,y+1);
	return;
    }
    
    if( wl[x][y] == 0 ){
	for(int w=1;w>=-1;w-=2){
	    wl[x][y] == w;
	    wl[y][x] == -w;
	    wn[x] += w;
	    wn[y] -= w;
	    if( -n+y < wn[x]&&wn[x] < n-y)
	    if( y == n-1 ){
		if(wn[x]==0)dfs(x+1,x+2);
	    }else{
		dfs(x,y+1);
	    }
	    wl[x][y] = 0;
	    wl[y][x] = 0;
	    wn[x] -=w;
	    wn[y] +=w;
	}
    }else{
	if(-n+y  <wn[x]&& wn[x]<n-y) 
	if( y == n-1 ){
	    if(wn[x]==0)dfs(x+1,x+2);
	}else{
	    dfs(x,y+1);
	}
    }
}


int main(){
    while(1){
	cin>>n;
	if(n==0)break;
	cnt = 0;
	wl = vector<vector<int> >(n,vector<int>(n,0) );
	wn = vector<int>(n,0);
	int m;
	cin>>m;
	for(int i=0;i<m;i++){
	    int x,y;
	    cin>>x>>y;
	    x--,y--;
	    wl[x][y] =  1;
	    wl[y][x] = -1;
	    wn[x]++;
	    wn[y]--;
	}
	dfs(0,1);
	//dfs(0,0,-1);
	cout<<cnt<<endl;
    }
    return 0;
}

