# [树形DP] HihoCoder #1471 Challenge 27 拥堵的城市

#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<iostream>
#define cl(x) memset(x,0,sizeof(x))
using namespace std;
typedef long long ll;

inline char nc(){
return getchar();
static char buf[100000],*p1=buf,*p2=buf;
}
char c=nc(),b=1;
for (;!(c>='0' && c<='9');c=nc()) if (c=='-') b=-1;
for (x=0;c>='0' && c<='9';x=x*10+c-'0',c=nc()); x*=b;
}

const int N=305;
const int P=1e9+7;

int Pow(int a,int b){
int res=1;
for (;b;b>>=1,a=1ll*a*a%P) if (b&1) res=1ll*res*a%P;
return res;
}

const int INV2=(P+1)/2;
ll fac[N<<1],inv[N<<1];
inline void Pre(int n){
/*
fac[0]=1; for (int i=1;i<=n;i++) fac[i]=fac[i-1]*i%P;
inv[1]=1; for (int i=2;i<=n;i++) inv[i]=inv[P%i]*(P-P/i)%P;
inv[0]=1; for (int i=1;i<=n;i++) (inv[i]*=inv[i-1])%=P;
*/
fac[0]=1;
for (int i=1;i<=n;i++) fac[i]=fac[i-1]*i%P;
for (int i=0;i<=n;i++) inv[i]=Pow(fac[i],P-2)%P;
}
inline ll C(int n,int m){
return fac[n]*inv[m]%P*inv[n-m]%P;
}

struct edge{
int u,v,next;
}G[N<<1];
inline void add(int u,int v,int p){
}

int n,K;
ll f[N][N];
ll tmp[N<<1],t2[N<<1];
int sz[N];
#define V G[p].v
inline void dfs(int u,int fa){
if (V!=fa)
dfs(V,u);
int flag=0;
memset(tmp,0,sizeof(tmp));
tmp[0]=tmp[1]=1;
sz[u]=1;
if (V!=fa){
cl(t2);
for (int i=0;i<=sz[u];i++)
if (tmp[i])
for (int j=0;j<=sz[V];j++)
if (f[V][j])
for (int k=0;k<=min(i,j);k++)
(t2[i+j-2*k]+=tmp[i]*f[V][j]%P*C(i,k)%P*C(j,k)%P*fac[k]%P)%=P;
cl(tmp);
for (int i=0;i<=sz[u]+sz[V];i++) tmp[i]=t2[i];
sz[u]+=sz[V];
}
for (int i=0;i<=K;i++)
f[u][i]=tmp[i];
}

int main(){
freopen("t.in","r",stdin);
freopen("t1.out","w",stdout);
int iu,iv;