N = int(input()) T = [[] for _ in range(N)] for _ in range(N - 1): a, b = (int(x) - 1 for x in input().split()) T[a].append(b) T[b].append(a) if N == 1: print(1);exit() MOD = 10 ** 9 + 7 MAX = 10 ** 5 + 10 modinv = lambda a, mod=MOD: pow(a, -1, mod) fac, inv = [1] * MAX, [1] * MAX for i in range(1, MAX): fac[i] = fac[i - 1] * i % MOD inv[i] = modinv(fac[i]) def comb(n, k, error=0): if not 0 <= k <= n: return error return fac[n] * inv[k] * inv[n - k] % MOD leaf = sum(len(v) == 1 for v in T[1:]) # http://www.nakano-lab.cs.gunma-u.ac.jp/Papers/080110.pdf ans = comb(N - 1, leaf - 1) * comb(N - 2, leaf - 1) * modinv(leaf) % MOD print(ans)