#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, T(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; struct P1{ mint a, b; P1(mint a):a(a){} P1(mint a, mint b):a(a), b(b){} P1 &operator+=(const P1 &p){ a+=p.a; b+=p.b; return *this; } P1 &operator-=(const P1 &p){ a-=p.a; b-=p.b; return *this; } P1 &operator*=(const P1 &p){ mint x=a*p.a, y=a*p.b+b*p.a; a=x, b=y; return *this; } P1 &operator/=(const P1 &p){ *this*=p.inv(); return *this; } P1 operator-() const{ return P1(-a, -b);} P1 operator+(const P1 &p) const{ return P1(*this)+=p;} P1 operator-(const P1 &p) const{ return P1(*this)-=p;} P1 operator*(const P1 &p) const{ return P1(*this)*=p;} P1 operator/(const P1 &p) const{ return P1(*this)/=p;} bool operator==(const P1 &p) const{ return a==p.a && b==p.b;} bool operator!=(const P1 &p) const{ return a!=p.a || b!=p.b;} P1 inv()const{ mint a1=a.inv(); return P1(a1, -b*a1*a1); } }; 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-1); bool e[101][101]={}; 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<