#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
struct TreeDiameter {
    int N; vector<set<int>> E;TreeDiameter() {} TreeDiameter(int _N) { init(_N); }
    void init(int _N) { N = _N; E.resize(N); }
    void add_edge(int a, int b) { E[a].insert(b); E[b].insert(a); }
    void build() {vector<int> dv(N), dw(N);rep(i, 0, N) dv[i] = 0;dfs(0, -1, dv);v = 0;
        rep(i, 0, N) if (dv[i] > dv[v]) v = i;rep(i, 0, N) dv[i] = 0;dfs(v, -1, dv);w = 0;
        rep(i, 0, N) if (dv[i] > dv[w]) w = i;rep(i, 0, N) dw[i] = 0;dfs(w, -1, dw);dia = dv[w];
        if (dia % 2 == 0) {int R = dia / 2;rep(i, 0, N) if (dv[i] == R && dw[i] == R) cent_even = i;
        vector<int> dc(N, 0);dfs(cent_even, -1, dc);rep(i, 0, N) if(dc[i]==R)leaf_even.push_back(i);}
        else {int R=dia/2;int c1=0, c2=0; rep(i, 0, N) if (dv[i] == R && dw[i] == R + 1) c1 = i;
        rep(i, 0, N)if (dv[i]==R+1&&dw[i]==R) c2 = i; cent_odd = { c1, c2 }; vector<int> dc1(N, 0);
        dfs(c1, -1, dc1); vector<int> dc2(N, 0); dfs(c2, -1, dc2);
        rep(i, 0, N) if (dc1[i] == R && dc2[i] == R + 1) leaf_odd.first.push_back(i);
        rep(i, 0, N) if (dc1[i] == R + 1 && dc2[i] == R) leaf_odd.second.push_back(i);}
        vector<int> cn(N); dfs2(0, -1, cn);int mi = N + 1;
        rep(i, 0, N) {int d = N - cn[i];fore(to, E[i]) if(cn[to] < cn[i]) d = max(d, cn[to]);
        if(d<mi){mi=d;centroid.clear();centroid.push_back(i);}else if(d==mi)centroid.push_back(i);}}
    void dfs(int cu,int pa,vector<int>& D){fore(to,E[cu])if(to!=pa){D[to]=D[cu]+1;dfs(to, cu, D);}}
    void dfs2(int cu,int pa,vector<int>& cn){cn[cu]=1;fore(to,E[cu])if(to!=pa){dfs2(to,cu,cn);cn[cu]+=cn[to];}}

    // out
    int v, w, dia;
    int cent_even; vector<int> leaf_even;
    pair<int, int> cent_odd; pair<vector<int>, vector<int>> leaf_odd;
    vector<int> centroid;
};

template<int MOD> struct ModInt {
    static const int Mod = MOD; unsigned x; ModInt() : x(0) { }
    ModInt(signed sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    ModInt(signed long long sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    int get() const { return (int)x; }
    ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; }
    ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
    ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
    ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
    ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
    ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
    ModInt inverse() const { long long a = x, b = MOD, u = 1, v = 0;
        while (b) { long long t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); }
        return ModInt(u); }
    bool operator==(ModInt that) const { return x == that.x; }
    bool operator!=(ModInt that) const { return x != that.x; }
    ModInt operator-() const { ModInt t; t.x = x == 0 ? 0 : Mod - x; return t; }
};
template<int MOD> ostream& operator<<(ostream& st, const ModInt<MOD> a) { st << a.get(); return st; };
template<int MOD> ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
    ModInt<MOD> r = 1; while (k) { if (k & 1) r *= a; a *= a; k >>= 1; } return r; }
template<typename T, int FAC_MAX> struct Comb { vector<T> fac, ifac;
    Comb() {fac.resize(FAC_MAX, 1); ifac.resize(FAC_MAX, 1);rep(i, 1, FAC_MAX) fac[i] = fac[i - 1] * i;
        rep(i, 1, FAC_MAX) ifac[i] = T(1) / fac[i];}
    T aPb(int a, int b) { if (b < 0 || a < b) return T(0); return fac[a] * ifac[a - b]; }
    T aCb(int a, int b) { if (b < 0 || a < b) return T(0); return fac[a] * ifac[a - b] * ifac[b]; }
    T nHk(int n, int k) { if (n == 0 && k == 0) return T(1); if (n <= 0 || k < 0) return 0;
        return aCb(n + k - 1, k); }}; // nHk = (n+k-1)Ck
typedef ModInt<1000000007> mint;
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int N;
vector<int> E[5010];
TreeDiameter td;
mint dp[5010][5010];
Comb<mint, 10101> com;
//---------------------------------------------------------------------------------------------------
int dfs(int cu, int pa) {
    int res = 1;
    fore(to, E[cu])  if (to != pa) res += dfs(to, cu);
    return res;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    td.init(N);
    rep(i, 0, N - 1) {
        int a, b; cin >> a >> b;
        a--; b--;
        E[a].push_back(b);
        E[b].push_back(a);
        td.add_edge(a, b);
    }
    td.build();
    assert(1 <= td.centroid.size() and td.centroid.size() <= 2);

    if (td.centroid.size() == 2) {
        mint ans = 1;
        rep(i, 1, N / 2 + 1) ans *= mint(i);
        ans *= ans;
        cout << ans << endl;
        return;
    }

    vector<int> v;
    int cn = td.centroid[0];
    fore(to, E[cn]) v.push_back(dfs(to, cn));

    //fore(i, v) printf("%d\n", i);


    map<int, mint> dp;
    dp[0] = 1;
    fore(i, v) {
        map<int, mint> pd;
        fore(p, dp) {
            rep(k, 0, i + 1) {
                //pd[p.first + k] += p.second * com.aPb(i, k);
                pd[p.first + k] += p.second * com.aCb(i, k) * com.aCb(i, k) *  com.fac[k];
            }
        }
        swap(dp, pd);
    }

    //fore(p, dp) printf("%d %d\n", p.first, p.second.get());

    fore(p, dp) p.second *= com.fac[N - p.first];

    //fore(p, dp) printf("%d %d\n", p.first, p.second.get());

    mint ans = 0;
    rep(i, 0, N) {
        ans += dp[i] * (mint(-1) ^ i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 99968