Code:
#include<bits/stdc++.h>
#define rep(i,j,k) for(int i=j;i<=k;i++)
#define mo 998244353
using namespace std;
template<typename T> void read(T &num){
char c=getchar();num=0;T f=1;
while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
while(c>='0'&&c<='9'){num=(num<<3)+(num<<1)+(c^48);c=getchar();}
num*=f;
}
template<typename T> void qwq(T x){
if(x>9)qwq(x/10);
putchar(x%10+'0');
}
template<typename T> void write(T x){
if(x<0){x=-x;putchar('-');}
qwq(x);putchar('\n');
}
inline void chkmod(int &x,int y){x=(x+y)%mo;}
struct wzy{
int nxt,vertice;
}edge[10010];
int head[5010];int len=0;
inline void add_edge(int x,int y){
edge[++len].nxt=head[x];edge[len].vertice=y;head[x]=len;return;
}
int siz[5010];int dp[5010][5010][3];int temp[5010][3];
inline void Pretreatment(int son,int father){
siz[son]=1;dp[son][1][0]=dp[son][0][2]=1;
for(int i=head[son];i;i=edge[i].nxt){
int nop=edge[i].vertice;
if(nop==father)continue;
Pretreatment(nop,son);
rep(j,1,siz[son]+siz[nop]){temp[j][0]=temp[j][1]=temp[j][2]=0;}
rep(j,0,siz[son]){
rep(k,0,siz[nop]){
int ret2=(dp[nop][k][0]+dp[nop][k][1])%mo;int ret1=(ret2+dp[nop][k][2])%mo;
chkmod(temp[j+k][0],(1ll*dp[son][j][0]*ret1)%mo);
if(j+k)chkmod(temp[j+k-1][1],(1ll*dp[son][j][0]*ret2)%mo);
chkmod(temp[j+k][1],(1ll*dp[son][j][1]*ret1)%mo);
if(j+k)chkmod(temp[j+k-1][2],(1ll*dp[son][j][1]*ret2)%mo);
chkmod(temp[j+k][2],(1ll*dp[son][j][2]*ret1)%mo);
}
}
siz[son]+=siz[nop];
rep(j,1,siz[son]){
dp[son][j][0]=temp[j][0];dp[son][j][1]=temp[j][1];dp[son][j][2]=temp[j][2];
}
}
return;
}
inline int poww(int n,int m){
int tmp=m;int temp=n;int re_value=1;
while(tmp){
if(tmp&1)re_value=(1ll*re_value*temp)%mo;
temp=(1ll*temp*temp)%mo;
tmp>>=1;
}
return re_value;
}
int main(){
int num,n;read(num);read(n);
rep(i,1,n-1){
int x,y;read(x);read(y);
add_edge(x,y);add_edge(y,x);
}
Pretreatment(1,0);
int ans=1;int xtq=((dp[1][1][0]+dp[1][1][1])%mo+dp[1][1][2])%mo;
int powe=1;int power=1;
rep(i,1,n){
powe=(1ll*powe*i)%mo;power=(1ll*power*xtq)%mo;
int byf=((dp[1][i][0]+dp[1][i][1])%mo+dp[1][i][2])%mo;
chkmod(ans,(1ll*((1ll*byf*powe)%mo)*poww(power,mo-2))%mo);
}
write(ans);
return 0;
}