#include using namespace std; const int M = 1000000007; long long powmod(long long a, long long b) { if (b == 0) return 1; long long t = powmod(a, b / 2); t = t * t % M; if (b & 1) t = t * a % M; return t; } long long inv(long long a) { return powmod(a, M - 2); } vector fact; long long comb(int n, int k) { if (k < 0 || k > n) return 0; return fact[n] * inv(fact[k]) % M * inv(fact[n - k]) % M; } int main() { int n; cin >> n; if (n == 1) { cout << "1\n"; return 0; } fact = vector(n * 2); fact[0] = 1; for (int i = 1; i < n * 2; ++i) fact[i] = fact[i - 1] * i % M; vector cnt(n); for (int i = 0; i < n - 1; ++i) { int a, b; cin >> a >> b; --a; --b; ++cnt[a]; ++cnt[b]; } int k = 0; for (int i = 1; i < n; ++i) if (cnt[i] == 1) ++k; cout << comb(n - 1, k) * comb(n - 1, k - 1) % M * inv(n - 1) % M << "\n"; return 0; }