from collections import Counter import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) mod = 10 ** 9 + 7 N = int(input()) G = [[] for _ in range(N)] for _ in range(N - 1): a, b = map(int, input().split()) a -= 1 b -= 1 G[a].append(b) G[b].append(a) dist = [-1] * N que = [0] dist[0] = 1 while que: s = que.pop() for t in G[s]: if dist[t] == -1: dist[t] = dist[s] + 1 que.append(t) fact = 1 for i in range(1, N + 1): fact = fact * i % mod ans = 0 for d, cnt in Counter(dist).items(): p = pow(d, mod - 2, mod) * fact % mod ans += p * cnt ans %= mod print(ans)