/*input
2
1 2
*/
#include <bits/stdc++.h>
using namespace std;
#define sp ' '
#define endl '\n'
#define fi first
#define se second
#define mp make_pair
#define int long long
#define N 5005
#define bit(x,y) ((x>>y)&1LL)
#define loop(i,l,r) for(int i=(int)(l); i<=(int)(r); i++)

void read(int &number) {
    bool negative = false;
    int c;
    number = 0;
    c = getchar();
    while (c == ' ' || c == '\n')
        c = getchar();
    if (c == '-') {
        negative = true;
        c = getchar();
    }
    for (; (c > 47 && c < 58); c = getchar())
        number = number * 10 + c - 48;
    if (negative)
        number = -number;
}

template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &a) {
    return os << '(' << a.first << ", " << a.second << ')';
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &a) {
    os << '[';
    for (unsigned int i = 0; i < a.size(); i++)
        os << a[i] << (i < a.size() - 1 ? ", " : "");
    os << ']';
    return os;
}
template <class T>
ostream &operator<<(ostream &os, const set<T> &a) {
    os << '{';
    for (typename set<T>::iterator it = a.begin(); it != a.end(); it++) {
        typename set<T>::iterator jt = it;
        os << *it << (++jt != a.end() ? ", " : "");
    }
    os << '}';
    return os;
}
template <class T1, class T2>
ostream &operator<<(ostream &os, map<T1, T2> &a) {
    os << "{\n";
    for (typename map<T1, T2>::iterator it = a.begin(); it != a.end(); it++) {
        typename map<T1, T2>::iterator jt = it;
        os << "  " << it->first << ": " << it->second << (++jt != a.end() ? ",\n" : "\n");
    }
    os << '}';
    return os;
}

int n;
vector<vector<int> > a(N);
vector<int> cen;
int child[N];

void dfs(int u, int p, bool Cen) {
    child[u] = 1;
    for (auto v : a[u]) {
        if (v == p) continue;
        dfs(v, u, Cen);
        child[u] += child[v];
    }
    if (!Cen) return;
    bool ok = true; int sum = 0;
    for (auto v : a[u]) {
        if (v == p) continue;
        if (child[v] > n / 2) ok = false;
        sum += child[v];
    }
    if ((n - 1 - sum) > n / 2) ok = false;
    if (ok) cen.push_back(u);
}

const int mod = 1e9 + 7;
class CKN {
    vector<vector<int> > a, c;
    vector<int> exp;
public:
    int C(int k, int n) {
        return c[k][n];
    }
    int P(int k) {
        return exp[k];
    }
    int A(int k, int n) {
        return a[k][n];
    }
    void init(int n) {
        a.assign(n + 5, vector<int>(n + 5, 0)); c.assign(n + 5, vector<int>(n + 5, 0));
        exp.assign(n + 5, 0);
        for (int i = 0; i <= n; ++i) a[0][i] = c[0][i] = 1; exp[0] = 1;
        for (int i = 1; i <= n; i++) exp[i] = 1LL * exp[i - 1] * i % mod;
        for (int i = 1; i <= n; ++i)
            for (int j = i; j <= n; ++j) {
                c[i][j] = (c[i][j - 1] + c[i - 1][j - 1]);
                a[i][j] = 1LL * a[i - 1][j] * (j - i + 1) % mod;
                if (c[i][j] >= mod) c[i][j] -= mod;
            }
    }
} comb;

int dp[2][N];
void solveOneCen() {
    dfs(cen[0], cen[0], 0);
    vector<int> branch;
    for (auto it : a[cen[0]]) branch.push_back(child[it]);
    dp[0][0] = 1; int sumchild = 0;
    loop(i, 0, branch.size() - 1) {
        int c = (i + 1) % 2;
        loop(j, 0, N - 1) {
            dp[c][j] = 0;
        }
        auto it = branch[i];
        loop(j, 0, sumchild) {
            loop(k, 0, it)
            dp[c][j + k] = (dp[c][j + k] + dp[c ^ 1][j] * comb.C(k, it) % mod * comb.A(k, it)) % mod;
        }
        sumchild += it;
    }
    int ans = comb.P(n);
    loop(i, 1, n) {
        int cur = dp[branch.size() % 2][i] * comb.P(n - i) % mod;
        if (i % 2) ans -= cur;
        else ans += cur;
        if (ans < 0) ans += mod; ans %= mod;
    }
    cout << ans << endl;
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    read(n);
    loop(i, 1, n - 1) {
        int u, v; read(u); read(v);
        a[u].push_back(v); a[v].push_back(u);
    }
    dfs(1, 1, 1);
    comb.init(n);
    if (cen.size() == 2) {
        cout << comb.P(n / 2) * comb.P(n / 2) % mod << endl;
        exit(0);
    }
    solveOneCen();
}

Measured memory_bytes: 394368