#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int n, m;
int field[10][10];
ll ans = 0;
int win[10];

void f(int person) {
    //cerr << "F: " << person << " " << win[person] << endl;
    if(person == n) {
        if(win[person] == 0) ans++;
        return;
    }
    int rest = n - person;
    if(win[person] < 0 || win[person] > rest) return;
    vector<int> bit(rest);
    for(int i = 0; i < win[person]; i++) bit[rest - 1 - i] = 1;
    do {
        //cerr << "A" << endl;
        bool out = false;
        for(int j = 1; j <= rest; j++) {
            if(field[person][person+j] == 0) continue;
            if((field[person][person+j] == 1) ^ (bit[j-1] == 1)) out = true;
        }
        if(out) continue;
        /*
        cerr << "BIT: ";
        for(int j = 0; j < bit.size(); j++) cerr << bit[j] << " ";
        cerr << endl;
        */
        for(int j = 1; j <= rest; j++) {
            if(!bit[j-1]) win[person+j]--;
        }
        f(person + 1);
        for(int j = 1; j <= rest; j++) {
            if(!bit[j-1]) win[person+j]++;
        }
    } while(next_permutation(bit.begin(), bit.end()));
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(true) {
        ans = 0;
        cin >> n;
        if(n == 0) break;
        for(int i = 1; i <= n; i++) win[i] = n / 2;
        cin >> m;
        for(int i = 1; i <= n; i++) {
            for(int j = 1; j <= n; j++) field[i][j] = 0;
        }
        while(m--) {
            int x, y;
            cin >> x >> y;
            if(x > y) field[y][x] = -1;
            else field[x][y] = 1;
        }
        f(1);
        cout << ans << endl;
    }
    return 0;
}
