#include /*#include #include */#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") using namespace std; /*namespace mp = boost::multiprecision; using Bint = mp::cpp_int; using Real = mp::number>; */#define lli long long int #define uli unsigned long long int #define INF 9999999999999999 #define rep(i,m,n) for(lli i = m;i < n;i++) #define rrep(i,m,n) for(lli i=m-1;i>=n;i--) #define pb(n) push_back(n) #define UE(N) N.erase(unique(N.begin(),N.end()),N.end()); #define Sort(n) sort(n.begin(), n.end()) #define Rev(n) reverse(n.begin(),n.end()) #define Out(S) cout << S << endl #define NeOut(S) cout << S #define HpOut(S) cout << setprecision(50) << S << endl #define Vec(K,L,N,S) vector K(N,S) #define DV(K,L,N,M,S) vector> K(N,vector(M,S)) #define TV(K,L,N,M,R,S) vector>> K(N,vector>(M,vector(R,S))) #define pint pair #define paf(L,R) pair #define mod 998244353 #define MAX 10000000 #define ALL(a) a.begin(),a.end() #define chmax(a, b) a = (((a)<(b)) ? (b) : (a)) #define chmin(a, b) a = (((a)>(b)) ? (b) : (a)) long long fac[MAX], finv[MAX], inv[MAX]; void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++){ fac[i] = fac[i - 1] * i % mod; inv[i] = mod - inv[mod%i] * (mod / i) % mod; finv[i] = finv[i - 1] * inv[i] % mod; } } lli nCr(lli n, lli r){ if (n < r) return 0; if (n < 0 || r < 0) return 0; return fac[n] * (finv[r] * finv[n - r] % mod) % mod; } lli modpow(lli n,lli k,lli m){ if(k==0)return 1; else if(k%2==1)return modpow(n,k-1,m)*n%m; else{ lli temp=modpow(n,k/2,m); return temp*temp%m; } } int main(){ ios::sync_with_stdio(false); cin.tie(0); lli A,B,X,Y,Z,N,M,num=0,sum=0,flag=0;string S,T; cin >> N >> M; COMinit(); Vec(G,pint,0,pint(0,0)); mapm1; while(M--){ cin >> A >> B; G.pb(pint(A-1,B-1)); m1[A-1]++; m1[B-1]++; } Vec(pk,pint,m1.size(),pint(0,0)); for(auto v:m1)pk.pb(pint(pk.size(),v.first)); mapm2; for(auto v:pk)m2[v.second]=v.first; rep(i,0,M){ G[i].first=m2[G[i].first]; G[i].second=m2[G[i].second]; } M=G.size(); Vec(dp,lli,N+1,1); Vec(dp2,lli,N+1,1); rep(i,2,N+1)dp[i]=i*(dp[i-1]+1)%mod; rep(i,2,N+1)dp2[i]=i*(dp2[i-1])%mod; rep(i,3,N+1)sum=(sum+dp2[i-1]*nCr(N,i)/2)%mod; for(lli i=1;i<(1<2)flag=0; if(!flag)continue; rep(j,0,30){ if(!Gp[j].size())continue; if(dist[j])continue; dist[j]=1; queueque; que.push(j); while(!que.empty()){ auto v=que.front();que.pop(); for(auto nv:Gp[v]){ if(dist[nv])continue; dist[nv]=dist[v]; que.push(nv); } } Z++; } if(Y-Z>=X){ if(X==1)sum+=pow(-1,X%2)*dp[N-2]; else{ num=0; rep(j,0,N-Y+1)num=(num+dp2[j]*nCr(N-Y,j)*nCr(j+Z-1,Z-1))%mod; sum+=pow(-1,X%2)*(dp2[Z-1]*modpow(2,Z-1,mod)%mod*num%mod); } } else if(X==Y&&Z==1)sum+=pow(-1,X%2); //cout << X << " " << Y << " " << Z << " " << sum << endl; sum=(sum+mod)%mod; } Out(sum); }