MOD = 10 ** 9 + 7 N = int(input()) UV = [list(map(int, input().split())) for _ in range(N - 1)] E = [[] for _ in range(N)] factn = 1 for i in range(1, N + 1): factn *= i factn %= MOD for u, v in UV: u -= 1 v -= 1 E[u].append(v) E[v].append(u) def dfs(u, p, g): G[g] += 1 for v in E[u]: if v != p: dfs(v, u, g + 1) G = [0] * N dfs(0, -1, 0) ans = 0 for i, g in enumerate(G, start = 1): ans += factn * pow(i,MOD-2,MOD) * g ans %= MOD print(ans)