#include #include // https://www.geeksforgeeks.org/combinatorics-ordered-trees/ using namespace std; const long long mod = 1000000007; vector g[100000]; long long F[100001]; long long IF[100001]; long long inv[100001]; int L; void dfs(int u, int p) { bool l = true; for (int v : g[u]) if (v != p) { dfs(v, u); l = false; } L += l; } long long C(int n, int r) { if (n < 0 || r < 0 || n < r) return 0; return F[n] * IF[r] % mod * IF[n - r] % mod; } int main() { int n; cin >> n; for (int i = 0; i < n - 1; i++) { int u, v; cin >> u >> v; u--; v--; g[u].push_back(v); g[v].push_back(u); } dfs(0, -1); inv[1] = 1; for (int i = 2; i <= n; i++) { inv[i] = inv[mod % i] * (mod - mod / i) % mod; } F[0] = 1; IF[0] = 1; for (int i = 1; i <= n; i++) { F[i] = F[i - 1] * i % mod; IF[i] = IF[i - 1] * inv[i] % mod; } cout << C(n - 1, L) * C(n - 1, L - 1) % mod * inv[n - 1] % mod << endl; }