#!/usr/bin/env python3.8 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines MOD = 10 ** 9 + 7 N = int(readline()) m = map(int, read().split()) AB = zip(m, m) deg = [0] * (N + 1) for a, b in AB: deg[a] += 1 deg[b] += 1 leaf = sum(x == 1 for x in deg) fact = [1] * N for n in range(1, N): fact[n] = fact[n - 1] * n % MOD num = fact[N - 1] * fact[N - 2] den = fact[leaf - 1] * fact[N - leaf] * fact[leaf - 1] * fact[N - leaf - 1] * leaf answer = num * pow(den, MOD - 2, MOD) % MOD print(answer)