#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef pair<pll, pll> node;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const ll Mod = 1000000007LL;
const int Maxn = 5e3 + 10;
const int Maxk = 60;
const ll Inf = 2242545357980376863LL;
const ll Log = 30;

vector<ll> G[Maxn];

ll sub[Maxn];
ll DFS(ll u, ll p){
	sub[u] = 1;
	for(auto adj : G[u]) if(adj != p) sub[u] += DFS(adj, u);
	return sub[u];
}
ll n;

ll cent(ll u, ll p){
	for(auto adj : G[u]){
		if(adj != p && sub[adj] + sub[adj] > n) return cent(adj, u);
	}
	return u;
}
ll mul(ll a, ll b){
	return (a * b) % Mod;
}
ll C[Maxn][Maxn];
ll f[Maxn];
vector<ll> A;

ll dp[Maxn][Maxn];

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	C[0][0] = 1;
	for(int i = 0; i < Maxn; i++) for(int j = 0; j <= i; j++) C[i][j] = (j == 0 ? 1 : C[i - 1][j] + C[i - 1][j - 1]) % Mod;
	f[0] = 1;
	for(int i = 1; i < Maxn; i++) f[i] = mul(i, f[i - 1]); 
	
	
	cin >> n;
	ll u, v;
	for(int i = 1; i < n; i++){
		cin >> u >> v;
		G[u].pb(v);
		G[v].pb(u);
	}
	DFS(1, -1);
	ll roid = cent(1, -1);
	//cerr << roid << '\n';
	for(auto adj : G[roid]){
		if(sub[adj] < sub[roid]) A.pb(sub[adj]);
	}
	if(sub[roid] < n) A.pb(n - sub[roid]);
	//for(auto x : A) cerr << x << ' '; cerr << '\n';
	ll N = A.size();
	ll rem = n;
	for(int i = 0; i <= A[0]; i++) dp[0][i] = mul(C[A[0]][i], mul(C[A[0]][i], f[i]));
	//cerr << dp[0][A[0]] << '\n';
	for(int i = 0; i < N - 1; i++){
		rem -= A[i];
		for(int j = 0; j <= n; j++){
			for(int k = 0; k <= A[i + 1]; k++){
				dp[i + 1][j + k] += mul( dp[i][j], mul( C[A[i + 1]][k], mul(C[A[i + 1]][k], f[k] )) );
				dp[i + 1][j + k] %= Mod;
			}
		}
	}
	for(int j = 0; j <= n; j++) dp[N - 1][j] = mul(dp[N - 1][j], f[n - j]);
	//for(int i = 0; i <= n; i++) cerr << dp[N - 1][i] << ' '; cerr << '\n';
	N--;
	ll S = 0;
	for(int i = n; i >= 0; i--){
		for(int j = i - 1; j >= 0; j--){
			dp[N][j] -= mul(dp[N][i], C[i][j]);
			dp[N][j] %= Mod;
		}
		//cerr << dp[N][i] << ' ';
		S += dp[N][i];
	}
	//cerr << S << '\n';
	dp[N][0] += Mod;
	cout << dp[N][0] % Mod;
	return 0;
}

/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/


Measured memory_bytes: 392960