/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(_,v.size())cout<<" "<<v[_];cout<<endl;
#define show2d(v) rep(__,v.size()){rep(_,v[__].size())cout<<" "<<v[__][_];cout<<endl;}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};

class Cent{
	public:
	int n;
	vi co,cent;
	vvi G;
	Cent(int size){
		n=size;
		G=vvi(n);
	}
	void add_edge(int a,int b){
		G[a].pb(b);
		G[b].pb(a);
	}
	void dfs(int u,int prev){
		co[u]=1;
		bool is_cent=true;
		for(auto v:G[u])if(v!=prev){
			dfs(v,u);
			co[u]+=co[v];
			if(co[v]>n/2)is_cent=false;
		}
		if(n-co[u]>n/2)is_cent=false;
		if(is_cent)cent.pb(u);
	}
	vi center(int s){
		co=vi(n);
		cent=vi();
		dfs(s,-1);
		return cent;
	}
};
//nCr mod m
#define MOD 1000000007
#define M 6000
vector<ll> fact;
bool h=false;
void init(){
	h=true;
	fact=vector<ll>(M);
	fact[0]=fact[1]=1;
	loop(i,2,M)fact[i]=fact[i-1]*i%MOD;
}
// a^b mod MOD
ll powmod(ll a,ll b,ll m=MOD){
	ll out=1;
	ll p=a%m;
	while(b){
		if(b&1)out=out*p%m;
		p=p*p%m;
		b>>=1;
	}
	return out;
}
//nCr
int memo[5050][5050];
ll nCr(ll n,ll r,ll m=MOD){
	if(!h)init();
	if(memo[n][r]+1)return memo[n][r];
	if(n<0||r<0||n<r)return 1;//??????
	ll out=fact[n]*powmod(fact[r]*fact[n-r]%m,m-2,m)%m;
	return memo[n][r]=out;
}
signed main(){
	rep(i,5050)rep(j,5050)memo[i][j]=-1;
	int n;
	cin>>n;
	Cent ce(n);
	rep(i,n-1){
		int a,b;
		cin>>a>>b;
		a--;b--;
		ce.add_edge(a,b);
	}
	vi cent=ce.center(0),co=ce.co;
	init();
	if(cent.size()==2){
		cout<<fact[n/2]*fact[n/2]%MOD<<endl;
		return 0;
	}
	ce.center(cent[0]);
	co=ce.co;
	vi T;
	rep(i,ce.G[cent[0]].size())T.pb(co[ce.G[cent[0]][i]]);
	vi dp(1,1);
	rep(i,T.size()){
		vi ndp(dp.size()+T[i]);
		rep(j,dp.size())rep(k,T[i]+1)
			(ndp[j+k]+=dp[j]*nCr(T[i],k)%MOD*nCr(T[i],k)%MOD*fact[k]%MOD)%=MOD;
		dp=ndp;
	}
	int out=0;
	rep(i,dp.size())(out+=MOD+dp[i]*fact[n-i]%MOD*(i%2?-1:1))%=MOD;
	cout<<out<<endl;
}















Measured memory_bytes: 200192