#include #include #include using namespace std; typedef long long ll; const ll mod = 1e9 + 7; ll modpow(ll a, ll b, ll p = 1e9+7){ if(b == 0) return 1; if(b % 2 == 0){ ll d = modpow(a, b/2, p); return (d*d) % p; }else{ return (a%p * modpow(a, b-1, p)) % p; } } struct ModComb{ vector po, inv; ll N; ModComb(ll n) : N(n), po(n), inv(n) { po[0] = 1; for(int i = 1; i < N; i++) po[i] = (po[i-1] * i) % mod; inv[N-1] = modpow(po[N-1], mod-2, mod); for(int i = N-2; i >= 0; i--) inv[i] = (inv[i+1] * (i+1)) % mod; } ll nCk(ll n, ll k){ if(k == 0) return 1; if(n < k) return 0; return (((po[n]*inv[n-k])%mod)*inv[k])%mod; } ll nPk(ll n, ll k){ if(k == 0) return 1; if(n < k) return 0; return (po[n]*inv[n-k])%mod; } ll nHk(ll n, ll k){ if(n == 0 && k == 0) return 1; return nCk(n+k-1, k-1); } }; int main(){ int n; cin >> n; vector dep(n, 0); vector v[n]; for(int i = 0; i < n-1; i++){ int a, b; cin >> a >> b; a--, b--; v[a].push_back(b); v[b].push_back(a); } queue> q; dep[0] = 1; for(int next : v[0]) q.push({next, 2}); while(!q.empty()){ auto p = q.front(); q.pop(); if(dep[p.first]) continue; dep[p.first] = p.second; for(int next : v[p.first]){ if(dep[next] == 0) q.push({next, p.second+1}); } } vector fact(n+1); fact[0] = 1; for(int i = 1; i <= n; i++) fact[i] = fact[i-1] * i % mod; ModComb mc(n+1); ll ans = 0; for(int i = 0; i < n; i++){ ans += mc.nCk(n, dep[i]) * fact[dep[i]-1] % mod * fact[n-dep[i]] % mod; ans %= mod; } cout << ans << endl; return 0; }