#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

int N;
vector<int> G[50010];
int sub[50010];
ll F[50010] = {1};
ll R[50010];
ll mod = 1000000007;
ll dp[5010][5010];

int sub_size(int v,int p)
{
    int res = 1;
    for(int i = 0; i < G[v].size(); i++)if(p != G[v][i])res += sub_size(G[v][i],v);
    return sub[v] = res;
}

ll con(int a,int b)
{
    return F[a] * R[a - b] % mod * R[b] % mod;
}

ll pow_mod(ll a,ll b)
{
    if(b == 0)return 1;
    ll res = pow_mod(a * a % mod, b / 2);
    if(b & 1)res = res * a % mod;
    return res;
}

int main()
{
    scanf("%d",&N);
    for(int i = 0; i < N - 1; i++)
    {
        int a,b;
        scanf("%d%d",&a,&b);
        G[a].push_back(b);
        G[b].push_back(a);
    }

    for(int i = 1; i < 5010; i++)F[i] = F[i - 1] * i % mod;
    for(int i = 0; i < 5010; i++)R[i] = pow_mod(F[i],mod - 2);

    for(int i = 1; i <= N; i++)
    {
        for(int j = 0; j < G[i].size(); j++)
        {
            if(sub_size(i,G[i][j]) == sub_size(G[i][j],i))
            {
                printf("%lld\n",F[N / 2] * F[N / 2] % mod);
                return 0;
            }
        }
    }

    int c = 0,MIN = 1001001001;
    for(int i = 1; i <= N; i++)
    {
        int MAX = 0;
        for(int j = 0; j < G[i].size(); j++)MAX = max(MAX,sub_size(G[i][j],i));
        if(MIN > MAX)
        {
            c = i;
            MIN = MAX;
        }
    }

    dp[0][0] = 1;
    for(int i = 0; i < G[c].size(); i++)
    {
        for(int j = 0; j <= N; j++)
        {
            if(dp[i][j] == 0)continue;
            int m = sub_size(G[c][i],c);
            for(int k = 0; k <= m; k++)
            {
                if(j + k > N)continue;
                dp[i + 1][j + k] += dp[i][j] * con(m,k) % mod * con(m,k) % mod * F[k] % mod;
                dp[i + 1][j + k] %= mod;
            }
        }
    }

    ll ans = 0;
    for(int i = 0; i <= N; i++)
    {
        ll tmp = dp[G[c].size()][i] * F[N - i] % mod;
        if(i % 2)ans -= tmp;
        else ans += tmp;
        ans = (ans + mod) % mod;
    }

    printf("%lld\n",ans);
    return 0;
}
