#include <bits/stdc++.h>
using namespace std;

#define int long long
#define rep(i,a,b) for(int i = a; i < b; i++)

int n,m;
int table[9][9];
int win[9];
int lose[9];
int ans;


void rec(int i=0, int j=0) {
    if (i == n && j == 0) {
        ans += 1;
        return;
    }
    int ni,nj;
    ni = i;
    nj = j + 1;

    if (nj > n-1) {
        ni = i + 1;
        nj = 0 ;
    }

    if (table[i][j] == 0) {
        if (i == j) return rec(ni, nj);

        if (win[i] + 1 <= n/2 && lose[j] + 1 <= n/2) {
            table[i][j] = 1;
            table[j][i] = -1;
            win[i] += 1;
            lose[j] +=1;
            rec(ni, nj);
            table[i][j] = 0;
            table[j][i] = 0;
            win[i] += -1;
            lose[j] += -1;
        }

        if (lose[i] + 1 <= n/2 && win[j] + 1 <= n/2) {
            table[i][j] = -1;
            table[j][i] = 1;
            lose[i] += 1;
            win[j] += 1;
            rec(ni, nj);
            table[i][j] = 0;
            table[j][i] = 0;
            lose[i] += -1;
            win[j] += -1;
        }
    }
    else {
        if (table[i][j] == 1) {
            if (win[i] <= n/2 && lose[j] <= n/2) {
                return rec(ni, nj);
            }
        }
        if (table[i][j] == -1) {
            if (lose[i] <= n/2 && win[j] <= n/2) {
                return rec(ni, nj);
            }
        }
    }
    return;
}

signed main() {
    while (true) {
        cin >> n;
        if(n==0) break;
        cin >> m;
        rep(i,0,n) rep(j,0,n) table[i][j] = 0;
        rep(i,0,n) win[i] = 0;
        rep(i,0,n) lose[i] = 0;
        rep(i,0,m) {
            int x,y;
            cin >> x >> y;
            x -= 1;
            y -= 1;
            table[x][y] = 1;
            table[y][x] = -1;
            win[x] += 1;
            lose[y] += 1;
        }

        ans = 0;

        rec();

        cout << ans << endl;
    }
}
