import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

immutable long MOD = 10^^9 + 7;
long[] F, FI;

void main() {
    auto N = readln.chomp.to!int;
    auto G = new int[][](N);
    foreach (_; 0..N-1) {
        auto s = readln.split.map!(to!int);
        G[s[0]-1] ~= s[1]-1;
        G[s[1]-1] ~= s[0]-1;
    }

    F = new long[](N+1);
    FI = new long[](N+1);
    F[0] = FI[0] = 1;
    foreach (i; 1..N+1) F[i] = F[i-1] * i % MOD;
    foreach (i; 1..N+1) FI[i] = FI[i-1] * powmod(i, MOD-2, MOD) % MOD;

    int c = -1;
    int c2 = -1;
    int[] A;

    int dfs(int n, int p) {
        bool center = true;
        int s = 0;
        int[] a;
        foreach (m; G[n]) {
            if (m == p) continue;
            int t = dfs(m, n);
            if (t > N / 2) center = false;
            s += t;
            a ~= t;
        }
        if (N - s - 1 > N / 2) {
            center = false;
        }
        if (center && c == -1) {
            c = n;
            A = a.dup ~ (N - s - 1);
        } else if (center) {
            c2 = n;
        }
        return s + 1;
    }

    dfs(0, -1);

    if (c2 != -1) {
        writeln(F[N/2] * F[N/2] % MOD);
        return;
    }


    int M = A.length.to!int;
    auto dp = new long[][](M+1, N+1);
    dp[0][0] = 1;

    foreach (i; 0..M) {
        foreach (j; 0..N) {
            if (dp[i][j] == 0) continue;
            foreach (k; 0..A[i]+1) {
                dp[i+1][j+k] += dp[i][j] * perm(A[i], k) % MOD * comb(A[i], k) % MOD;
                dp[i+1][j+k] %= MOD;
            }
        }
    }

    long ans = 0;

    foreach (i; 0..N+1) {
        long tmp = dp[M][i] * F[N-i] % MOD;
        if (i % 2 == 1) tmp *= -1;
        ans += tmp;
        ans %= MOD;
    }

    ans = (ans + MOD) % MOD;
    ans.writeln;
}

long comb(long n, long r) {
    return F[n] * FI[n-r] % MOD * FI[r] % MOD;
}

long perm(long n, long r) {
    return F[n] * FI[n-r] % MOD;
}

long powmod(long a, long x, long m) {
    long ret = 1;
    while (x) {
        if (x % 2) ret = ret * a % m;
        a = a * a % m;
        x /= 2;
    }
    return ret;
}
