#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repr(i, s, n) for (int i = (s); i < (int)(n); i++) #define revrep(i, n) for (int i = (n) - 1; i >= 0; i--) #define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--) #define debug(x) cerr << #x << ": " << x << "\n" #define popcnt(x) __builtin_popcount(x) const double PI = acos(-1.0); using ll = long long; using P = pair; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template istream& operator >>(istream &is, vector &v) { for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i); return is; } template ostream& operator <<(ostream &os, pair p) { cout << '(' << p.first << ", " << p.second << ')'; return os; } template void print(const vector &v, const string &delimiter) { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; } template void print(const vector> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); } struct ModInt { static ll mod; ll val; ModInt(ll v = 0) : val(v % mod) {} ModInt operator-() const { return ModInt(val ? mod - val : val); } ModInt &operator+=(ModInt a) { if ((val += a.val) >= mod) val -= mod; return *this; } ModInt &operator-=(ModInt a) { if ((val -= a.val) < 0) val += mod; return *this; } ModInt &operator*=(ModInt a) { val = (__uint128_t(val) * a.val) % mod; return *this; } ModInt &operator/=(ModInt a) { ll u = 1, v = a.val, s = 0, t = mod; while (v) { ll q = t / v; swap(s -= u * q, u); swap(t -= v * q, v); } a.val = (s < 0 ? s + mod : s); val /= t; return (*this) *= a; } ModInt inv() const { return ModInt(1) /= (*this); } bool operator<(ModInt x) const { return val < x.val; } }; ll ModInt::mod = 1e9 + 7; ostream &operator<<(ostream &os, ModInt a) { os << a.val; return os; } ModInt operator+(ModInt a, ModInt b) { return a += b; } ModInt operator-(ModInt a, ModInt b) { return a -= b; } ModInt operator*(ModInt a, ModInt b) { return a *= b; } ModInt operator/(ModInt a, ModInt b) { return a /= b; } ModInt pow(ModInt a, ll e) { ModInt x(1); for (; e > 0; e /= 2) { if (e % 2 == 1) x *= a; a *= a; } return x; } ModInt comb(int n, int k) { ModInt x = 1, y = 1; rep(i, k) { x *= n - i; y *= i + 1; } return x / y; } const long long MOD = 1000000007; const int MAX = 200010; long long fac[MAX], finv[MAX], inv[MAX]; void comb_init() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++){ fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } long long mod_comb(int n, int k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } vector> graph; int depth[200000]; void dfs(int v, int d, int pre = -1) { depth[v] = d; for (int to: graph[v]) if (to != pre) dfs(to, d + 1, v); } int main() { int n; cin >> n; graph.resize(n); rep(i, n - 1) { int u, v; cin >> u >> v; u--; v--; graph[u].push_back(v); graph[v].push_back(u); } dfs(0, 0); comb_init(); ModInt ans = 0; ans += fac[n]; repr(i, 1, n) { ans += ModInt(mod_comb(n, depth[i] + 1)) * fac[depth[i]] * fac[n - depth[i] - 1]; } cout << ans << endl; }