#pragma region
#ifndef M207
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,popcnt")
#endif
#include <bits/stdc++.h>
using namespace std;
#define ri register int
#define il inline
#define LL long long
#define uint unsigned int
#define ull unsigned long long
#define solid const auto &
#define pb emplace_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<LL,LL>
#define fi first
#define se second
#define gm int mid((l+r)/2)
#define space putchar(' ')
#define enter putchar('\n')
#define rd() ({ri t;in(t);t;})
#define Size(x) ((int)x.size())
#define mem(x,y) memset(x,y,sizeof(x))
template<class T>il void in(T &x)
{
	x=0; char c=getchar(); bool f=0;
	while(!isdigit(c)) f|=(c=='-'),c=getchar();
	while(isdigit(c)) x=x*10+(c^'0'),c=getchar();
	f?x=-x:0;
}
template<class T>il void out(T x,const char c='\n')
{
	static short st[30]; short m=0;
	if(x<0) putchar('-'),x=-x;
	do st[++m]=x%10,x/=10; while(x);
	while(m) putchar(st[m--]|'0');
	putchar(c);
}
template<class T>il void err(const T &x,const char c='\n') {cerr<<x<<c;}
template<class T,class ...Args>il void in(T &x,Args &...args) {in(x); in(args...);}
template<class T,class ...Args>il void out(const T &x,const Args &...args) {out(x,' '); out(args...);}
template<class T,class ...Args>il void err(const T &x,const Args &...args) {err(x,' '); err(args...);}
template<class T>il void prt(T a[],int n) {for(ri i=0; i<n; ++i) out(a[i],i==n-1?'\n':' ');}
template<class T>il void clr(T a[],int n) {memset(a,0,sizeof(T)*n);}
template<class T>il void clr(T *a,T *b) {memset(a,0,sizeof(T)*(b-a));}
template<class T>il bool ckmax(T &a,const T &b) {return a<b?a=b,1:0;}
template<class T>il bool ckmin(T &a,const T &b) {return a>b?a=b,1:0;}
namespace MOD_CALC
{
const int md=1e9+7,inv2=(md+1)/2;
il int add(const int a,const int b) {return a+b>=md?a+b-md:a+b;}
il int sub(const int a,const int b) {return a-b<0?a-b+md:a-b;}
il int mul(const int a,const int b) {return (LL)a*b%md;}
il void inc(int &a,const int b) {(a+=b)>=md?a-=md:0;}
il void dec(int &a,const int b) {(a-=b)<0?a+=md:0;}
il int qpow(int a,int b) {int r=1; for(; b; b>>=1,a=mul(a,a)) if(b&1) r=mul(r,a); return r;}
il int qpow(int a,int b,const int p) {int r=1; for(; b; b>>=1,a=(LL)a*a%p) if(b&1) r=(LL)r*a%p; return r;}
il int mdinv(const int a) {return qpow(a,md-2);}
template<class ...Args>il int add(const int a,const int b,const Args &...args) {return add(add(a,b),args...);}
template<class ...Args>il int mul(const int a,const int b,const Args &...args) {return mul(mul(a,b),args...);}
} using namespace MOD_CALC;
namespace i207M
{
#pragma endregion
#define N 5005
int n;
vector<int> E[N];
int sz[N];
int mnsz=1e9,root;
void getrt(int x,int _fa)
{
	sz[x]=1; int t=0;
	for(solid v:E[x])
	{
		if(v==_fa) continue;
		getrt(v,x);
		sz[x]+=sz[v];
		ckmax(t,sz[v]);
	}
	ckmax(t,n-sz[x]);
	if(ckmin(mnsz,t)) root=x;
}
int st[N],tp;
int dp[N];
int fac[N],ifac[N];
il int C(int n,int m) {return n<m?0:mul(fac[n],ifac[m],ifac[n-m]);}
signed main()
{
#ifdef M207
	freopen("in.in","r",stdin);
	// freopen("ot.out","w",stdout);
#endif
	in(n);
	fac[0]=1;
	for(ri i=1; i<=n; ++i) fac[i]=mul(fac[i-1],i);
	ifac[n]=mdinv(fac[n]);
	for(ri i=n; i>=1; --i) ifac[i-1]=mul(ifac[i],i);
	for(ri i=1,a,b; i<n; ++i)
	{
		in(a,b);
		E[a].pb(b),E[b].pb(a);
	}
	getrt(1,0);
	for(solid v:E[root])
		st[++tp]=(sz[v]>sz[root]?n-sz[root]:sz[v]);
	dp[0]=1; int sum=0;
	for(ri i=1; i<=tp; ++i)
	{
		sum+=st[i];
		for(ri j=sum; j>=0; --j)
		{
			int t=0;
			for(ri k=0; k<=j&&k<=st[i]; ++k)
				inc(t,mul(dp[j-k],fac[st[i]],ifac[st[i]-k],C(st[i],k)));
			dp[j]=t;
		}
		// prt(dp,n);
	}
	// prt(st+1,tp);
	int ans=0;
	for(ri i=0; i<n; ++i)
		if(i&1) dec(ans,mul(dp[i],fac[n-i]));
		else inc(ans,mul(dp[i],fac[n-i]));
	out(ans);
	return 0;
}
#pragma region
}
signed main()
{
	i207M::main();
	return 0;
}
#pragma endregion


Measured memory_bytes: 768