#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0;
  bool flg = false;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') flg = true;
  for (; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + (ch ^ 48);
  return flg ? -x : x;
}
const int mod = 998244353;
const long long smod = 1LL * mod * mod;
inline int upd(const int &x) { return x + (x >> 31 & mod); }
inline void add(int &x, const int &y) { x = upd(x + y - mod); }
inline void iadd(int &x, const int &y) { x = upd(x - y); }
inline long long supd(const long long &x) { return x + (x >> 63 & smod); }
inline void sadd(long long &x, const long long &y) { x = supd(x + y - smod); }
int qpow(int x, int y) {
  int res = 1;
  for (; y; y >>= 1, x = 1LL * x * x % mod)
    if (y & 1) res = 1LL * res * x % mod;
  return res;
}
int n, m;
int lim;
int e[32];
int O[1 << 18];
int f[1 << 18];
int pop[1 << 18];
int c[32], q;
int ans;
int msk[1 << 18], tot[1 << 18];
void solve() {
  n = read(), m = read();
  for (int i(1), _i(m); i <= _i; i++) {
    int u = read(), v = read();
    e[u - 1] |= 1 << v - 1;
  }
  lim = (1 << n) - 1;
  for (int i(1), _i(lim); i <= _i; i++) pop[i] = pop[i >> 1] + (i & 1);
  for (int i(1), _i(lim); i <= _i; i++) {
    for (int j(0), _j(n - 1); j <= _j; j++)
      if (i >> j & 1) O[i] |= e[j];
  }
  f[0] = 1;
  for (int i(1), _i(lim); i <= _i; i++) {
    for (int j = i; j; j = (j - 1) & i)
      if (O[j] & j)
        ;
      else
        (pop[j] & 1 ? add : iadd)(f[i], f[i ^ j]);
  }
  for (int i(1), _i(lim - 1); i <= _i; i++) {
    if (O[i] & i) continue;
    q = 0;
    for (int j(0), _j(n - 1); j <= _j; j++)
      if (i >> j & 1 ^ 1) c[q++] = j;
    int top = 1;
    msk[0] = tot[0] = 0;
    for (int _(0), __(q - 1); _ <= __; _++) {
      const int o = c[_], p = pop[e[o] & i];
      for (int j(top - 1), _j(0); j >= _j; j--) {
        msk[j | top] = msk[j] | 1 << o;
        tot[j | top] = tot[j] + p;
      }
      top <<= 1;
    }
    long long z = 0;
    for (int j(0), _j(top - 1); j <= _j; j++) {
      const int &S = msk[j], &T = tot[j];
      sadd(z, 1LL * f[S] * f[(~0 ^ S ^ i) & lim] % mod * T);
    }
    (pop[i] & 1 ? add : iadd)(ans, z % mod);
  }
  printf("%d\n", ans);
}
int main() {
  for (int T = 1; T--;) solve();
  return 0;
}
