#include <bits/stdc++.h>
using namespace std;
namespace modular_space {
	long long mod;
	struct umod {
		long long val;
		umod(): val(0ll){}
		umod(long long x){ x %= mod; if(x < 0) x += mod; val = x; }
		umod& operator += (umod oth){ val += oth.val; if(val >= mod) val -= mod; return *this; }
		umod& operator -= (umod oth){ val -= oth.val; if(val < 0) val += mod; return *this; }
		umod& operator *= (umod oth){ val = val * oth.val % mod; return *this; }
		umod& operator /= (umod oth){ return *this *= oth.inverse(); }
		umod& operator ^= (long long oth){ return *this = pwr(*this, oth); }
		umod operator + (umod oth) const { return umod(*this) += oth; }
	       	umod operator - (umod oth) const { return umod(*this) -= oth; }
		umod operator * (umod oth) const { return umod(*this) *= oth; }
		umod operator / (umod oth) const { return umod(*this) /= oth; }
		umod operator ^ (long long oth) const { return umod(*this) ^= oth; }
		bool operator < (umod oth) const { return val < oth.val; }
		bool operator > (umod oth) const { return val > oth.val; }
		bool operator <= (umod oth) const { return val <= oth.val; }
		bool operator >= (umod oth) const { return val >= oth.val; }
		bool operator == (umod oth) const { return val == oth.val; }
		bool operator != (umod oth) const { return val != oth.val; }
		umod pwr(umod a, long long b) const {
			umod r = 1;
			for(; b; a *= a, b >>= 1)
				if(b&1)
					r *= a;
			return r;
		}
		umod inverse() const {
			long long a = val, b = mod, u = 1, v = 0;
			while(b){
				long long t = a/b;
				a -= t * b; swap(a, b);
				u -= t * v; swap(u, v);
			}
			if(u < 0)
				u += mod;
			return u;
		}
		friend istream& operator >> (istream &is, umod &oth);
		friend ostream& operator << (ostream &os, const umod& oth);
	};
	ostream& operator << (ostream &os, const umod &oth){
		os << oth.val;
		return os;
	}
	istream& operator >> (istream &is, umod &oth){
		long long x; is >> x;
		oth = umod(x);
		return is;
	}
	struct binprime_kit {
		int sz;
		vector<umod> fat, ifat;
		void init(int s){
			sz = s;
			fat.resize(sz + 1);
			ifat.resize(sz + 1);
			fat[0] = 1;
			for(int i = 1; i <= sz; i++) fat[i] = fat[i - 1] * i;
			ifat[sz] = fat[sz] ^ (mod - 2);
			for(int i = sz - 1; i >= 0; i--) ifat[i] = ifat[i + 1] * (i + 1);
		}
		umod coef(int n, int r){
			if(n < r) return 0;
			return fat[n] * (ifat[r] * ifat[n - r]);
		}
	};
};
using U = modular_space::umod;
const int maxn = 5050;
vector<int> to[maxn];
int sub[maxn], par[maxn];
void dfs(int u, int p){
	par[u] = p;
	sub[u] = 1;
	for(int v : to[u]){
		if(v == p) continue;
		dfs(v, u);
		sub[u] += sub[v];
	}
}
int main(){
	modular_space::mod = 1'000'000'007;
	modular_space::binprime_kit kit; kit.init(maxn + maxn);
	int n; cin >> n;
	for(int i = 0; i < n - 1; i++){
		int u, v; cin >> u >> v;
		to[u].push_back(v);
		to[v].push_back(u);
	}
	dfs(1, 0);
	vector<int> troid;
	for(int i = 1; i <= n; i++){
		bool ok = true;
		for(int v : to[i]){
			if(v == par[i]) continue;
			ok &= 2 * sub[v] <= n;
		}	
		ok &= 2 * (n - sub[i]) <= n;
		if(ok) troid.push_back(i);
	}
	if(troid.size() == 2){
		cout << kit.fat[n / 2] * kit.fat[n / 2] << endl;
	} else {
		vector<int> sz;
		int u = troid[0];
		for(int v : to[u]){
			dfs(v, u);
			sz.push_back(sub[v]);
		}
		vector<U> f(n + n, 0), nf(n + n, 0); f[0] = 1;
		for(int s : sz){
			fill(nf.begin(), nf.end(), U(0));
			for(int j = 0; j <= s; j++){
				for(int prv = 0; prv <= n; prv++){
					if(f[prv] == 0) continue;
					nf[prv + j] += f[prv] * kit.coef(s, j) * kit.coef(s, j) * kit.fat[j];
				}
			}
			f = nf;
		}
		U ans = kit.fat[n];
		for(int i = 1; i <= n; i++){
			f[i] = f[i] * kit.fat[n - i];
			if(i&1) ans -= f[i];
			else ans += f[i];
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 1024