import sys import itertools import heapq import bisect from collections import deque, defaultdict from functools import lru_cache, cmp_to_key input = sys.stdin.readline # for AtCoder Easy test if __file__ != 'prog.py': sys.setrecursionlimit(10 ** 6) def readints(): return map(int, input().split()) def readlist(): return list(readints()) def readstr(): return input().rstrip() class Combination: def __init__(self, N, mod): self.N = N self.mod = mod self.f = [None] * (N + 1) self.finv = [None] * (N + 1) self.inv = [None] * (N + 1) self.f[0] = 1 self.f[1] = 1 self.finv[0] = 1 self.finv[1] = 1 self.inv[1] = 1 for i in range(2, N + 1): self.f[i] = self.f[i - 1] * i % self.mod self.inv[i] = self.mod - self.inv[self.mod % i] * (self.mod // i) % self.mod self.finv[i] = self.finv[i - 1] * self.inv[i] % self.mod def P(self, n, k): if n < k: return 0 if n < 0 or k < 0: return 0 return self.f[n] * self.finv[n - k] % self.mod def C(self, n, k): if n < k: return 0 if n < 0 or k < 0: return 0 return self.f[n] * (self.finv[k] * self.finv[n - k] % self.mod) % self.mod # 重複組合せ # n種類のものからk個選ぶ def H(self, n, k): if n == 0 and k == 0: return 1 return self.C(k + n - 1, k) N = int(input()) E = [[] for _ in range(N)] mod = 10 ** 9 + 7 comb = Combination(N, mod) for _ in range(N - 1): u, v = readints() u -= 1 v -= 1 E[u].append(v) E[v].append(u) D = [0] * N stack = [(0, -1)] while stack: v, p = stack.pop() if p >= 0: D[v] = D[p] + 1 for d in E[v]: if d == p: continue stack.append((d, v)) ans = 0 for i in range(N): ans += pow(D[i] + 1, mod - 2, mod) ans %= mod for i in range(1, N + 1): ans *= i ans %= mod print(ans)