#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define popcount __builtin_popcount using namespace std; typedef long long ll; typedef pair P; struct unionfind{ vector par, sz; unionfind() {} unionfind(int n):par(n), sz(n, 1){ for(int i=0; isz[y]) swap(x, y); par[x]=y; sz[y]+=sz[x]; } bool same(int x, int y){ return find(x)==find(y); } int size(int x){ return sz[find(x)]; } }; template struct ModInt{ int x; ModInt(): x(0){} ModInt(ll y): x(y>=0 ? y%MOD : (MOD-(-y)%MOD)%MOD){} ModInt &operator+=(const ModInt &p){ if((x+=p.x)>=MOD) x-=MOD; return *this; } ModInt &operator-=(const ModInt &p){ if((x+=MOD-p.x)>=MOD) x-=MOD; return *this; } ModInt &operator*=(const ModInt &p){ x=(int)(1ll*x*p.x%MOD); return *this; } ModInt &operator/=(const ModInt &p){ *this*=p.inv(); return *this; } ModInt operator-() const{ return ModInt(-x);} ModInt operator+(const ModInt &p) const{ return ModInt(*this)+=p;} ModInt operator-(const ModInt &p) const{ return ModInt(*this)-=p;} ModInt operator*(const ModInt &p) const{ return ModInt(*this)*=p;} ModInt operator/(const ModInt &p) const{ return ModInt(*this)/=p;} bool operator==(const ModInt &p) const{ return x==p.x;} bool operator!=(const ModInt &p) const{ return x!=p.x;} ModInt pow(ll n) const{ ModInt ret(1), p(x); while(n){ if(n&1) ret*=p; p*=p; n>>=1; } return ret; } ModInt inv() const{ return pow(MOD-2); } }; const int MOD=998244353; using mint=ModInt; template struct Matrix{ vector> a; Matrix(){} Matrix(size_t n, size_t m):a(n, vector(m, 0)){} Matrix(size_t n):Matrix(n, n){} Matrix(vector> a):a(a){} size_t height() const{ return a.size(); } size_t width() const{ return a[0].size(); } inline const vector &operator[](size_t k) const{ return a[k]; } inline vector &operator[](size_t k){ return a[k]; } static Matrix I(size_t n){ Matrix mat(n); for(int i=0; i> c(n, vector(l, 0)); for(int i=0; i>=1; } return ret; } static pair Gauss_Jordan(const Matrix &a, const Matrix &b){ size_t n=a.height(), m=a.width(), l=b.width(); Matrix c(n, m+l); for(int i=0; i, vector>> linear_equations(const Matrix &a, const vector &b){ int n=a.height(), m=a.width(); Matrix B(n, 1); for(int i=0; i myon(n,-1); vector nuo(m, -1); for(int i=0; i retc; vector> retd; return make_pair(retc, retd); } } vector c(m); vector> d; for(int i=0; i v(m); v[i]=1; for(int j=0; j; int main() { int n, m; cin>>n>>m; unionfind uf(n); int a[100010], b[100010]; for(int i=0; i>u>>v; u--; v--; a[i]=u, b[i]=v; uf.unite(u, v); } vector v; for(int i=0; i()); if(v.size()==1){ cout<<0< w[101]; for(int i=0; i mat1(n, Mat(n-1)); mint d=ans; for(int i=0; ii) x--; for(int k=0; ki) y--; if(e[j][k]) mat1[i][x][y]-=1; } } mat1[i]=mat1[i].inv(); } for(int i=0; iv[1]){ int c=0; for(auto x:v) if(x==v[1]) c++; ans*=mint(c*v[0]*v[1]); }else{ int c=0; for(auto x:v){ if(x==v[0]) c++; } ans*=mint(c*(c-1)/2*v[0]*v[0]); } cout<