#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include <fstream>
#include <time.h>
#include <iterator>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
//#define int long long
#define all(x) (x).begin(), (x).end()
using namespace std;
int MOD = (ll)1000000000 + 7;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 200020;




int G[10][10], win[10], lose[10];
int N, M;
int dfs(int N, int G2[10][10], int win[10], int lose[10]) {
	int res = 0;
	bool found = false;
	// REP(i, N) {
	// REP(j, N) {
	// pe(G2[i][j]);
	// }
	// cout << endl;
	// }cout << endl;
	FOR(i, 0, N - 1) {
		FOR(j, i + 1, N) {
			int wi = win[i], li = lose[i], wj = win[j], lj = lose[j];
			if (win[i] > N / 2 || lose[j] > N / 2 || win[j] > N / 2 || lose[i] > N / 2)return 0;
			if (G2[i][j] == 0) {
				//printf("%d: %d - %d\n", i, win[i], lose[i]);
				//printf("%d: %d - %d\n", j, win[j], lose[j]);
				found = true;
				bool ok = false;
				
				if (win[i] < N / 2 && lose[j] < N / 2) {
					ok = true;
					int G3[10][10];
					int win2[10], lose2[10];
					REP(i, 10) {
						win2[i] = win[i];
						lose2[i] = lose[i];
						REP(j, 10) {
							G3[i][j] = G2[i][j];
						}
					}
					G3[i][j] = 1;
					win[j] = wj, lose[i] = li;
					win2[i] = wi + 1, lose2[j] = lj + 1;
					res += dfs(N, G3, win2, lose2);
				}
				//G[i][j] = 0;
				win[i] = wi, win[j] = wj, lose[i] = li, lose[j] = lj;
				if (lose[i] < N / 2 && win[j] < N / 2) {
					ok = true;
					int G3[10][10];
					int win2[10], lose2[10];
					REP(i, 10) {
						win2[i] = win[i];
						lose2[i] = lose[i];
						REP(j, 10) {
							G3[i][j] = G2[i][j];
						}
					}
					G3[i][j] = -1;
					win[i] = wi, lose[j] = lj;
					lose2[i] = li + 1, win2[j] = wj + 1;
					res += dfs(N, G3, win2, lose2);
				}
				if (!ok)return 0;
				if (ok)return res;
				//G[i][j] = 0;
				win[i] = wi, win[j] = wj, lose[i] = li, lose[j] = lj;
			}
		}
	}

	if (!found)res = 1;
	return res;
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	while (true) {
		cin >> N;
		if (N == 0)break;
		cin >> M;
		//print(N)print(M);
		REP(i, 10) {
			win[i] = 0, lose[i] = 0;
		}
		REP(i, 10) {
			REP(j, 10) {
				G[i][j] = 0;
			}
		}
		REP(i, M) {
			int x, y; cin >> x >> y;
			//pe(x)print(y);
			x--, y--;
			if (x < y) {
				G[x][y] = 1;
				win[x]++, lose[y]++;
			}
			else {
				G[y][x] = -1;
				win[x]++, lose[y]++;
			}
		}
		/*REP(i, N) {
		REP(j, N) {
		pe(G[i][j]);
		}
		cout << endl;
		}*/
		int ans = dfs(N, G, win, lose);
		//cout << "ans:";
		cout << ans << endl;
	}
}



Measured memory_bytes: 3136