//Create Time: 2018-05-04 20:34:43
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <functional>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cctype>
#include <ctime>
#include <utility>
#include <complex>
#include <cassert>
#include <climits>
#include <iterator>
#include <tuple>
using namespace std;
#define snuke(i,x) for (__typeof((x).begin()) i = (x).begin(); i != (x).end(); ++i)
#define rep(i,a,n) for (int i=(a);i<(n);i++)
#define per(i,n,a) for (int i=(n)-1;i>=(a);i--)
// #define OUT(x) std::cout<<(#x)<<":"<<(x)<<std::endl
// #define TST(x) std::cout<<(#x)<<":"<<(x)<<" "
#define OUT(args...) {string _s=#args;replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s);istream_iterator<string> _it(_ss);OUT_TST("\n",_it,args);}
#define TST(args...) {string _s=#args;replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s);istream_iterator<string> _it(_ss);OUT_TST("",_it,args);}
#define SZ(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define unq(x) sort(all(x)),(x).erase(unique(all(x)),(x).end())
#define mem(f,x) memset((f), (x), sizeof(f))
#define clr(f) mem(f,0)
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define eb emplace_back
#define DEBUG
void OUT_TST(string s,istream_iterator<string> it) {cerr<<s;}
template<typename T, typename... Args> void OUT_TST(string s,istream_iterator<string> it,T a,Args... args){cerr<<*it<<"="<<a<<" ";OUT_TST(s,++it,args...);}
template<class T> void rd(T&ret){ret=0;bool ok=0,u=0;for(;;){int c=getchar();if(c>='0'&&c<='9')ret=(ret<<3)+(ret<<1)+c-'0',ok=1;else if(c=='-')u=1;else if(ok){if(u)ret*=-1;return;}}}
long long powmod(long long p,long long n,long long mod){long long ret=1;for(;n;n>>=1){if(n&1)ret=ret*p%mod;p=p*p%mod;}return ret;}
template <class T> bool chmin(T& a, const T &b) {return b < a? a = b, 1: 0;}
template <class T> bool chmax(T& a, const T &b) {return b > a? a = b, 1: 0;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii > vii;
typedef tuple<int,int,int> tp;
/****head****/
const int N=5005;
const ll mod=(ll)1e9+7;
void add(int &a,int b){
    a+=b;if(a>=mod)a-=mod;
}
template<int sz> struct Comb{
    const ll mod = ::mod;
    ll *fac, *ifac;
    ll mem_fac[sz+5],mem_ifac[sz+5];

    // long long powmod(long long p,long long n,long long mod){long long ret=1;for(;n;n>>=1){if(n&1)ret=ret*p%mod;p=p*p%mod;}return ret;}

    Comb(ll *fa=0,ll *ifa=0){
        fac=fa?fa:mem_fac;
        ifac=ifa?ifa:mem_ifac;
        fac[0]=ifac[0]=1;
        for(int i=1;i<sz;++i){
            fac[i]=i*fac[i-1]%mod;
            ifac[i]=powmod(fac[i],mod-2,mod);
        }
    }
    ll C(ll n,ll m){  // n >= m
        if(n<m)return 0;
        return (fac[n]*ifac[m]%mod)*ifac[n-m]%mod;
    }
    ll A(ll n,ll m){
        if(n<m)return 0;
        return fac[n]*ifac[n-m]%mod;
    }
};

ll fac[N],fnv[N];
Comb<N> comb(fac,fnv);
int dp[N][N],flag,n,bn[N],sz[N];
vi eg[N];
void dfs(int u,int fa){
    sz[u]=1;
    bool gg=0;
    for(int v:eg[u])if(v!=fa){
        dfs(v,u);
        sz[u]+=sz[v];
        if(sz[v]*2>=n)gg=1;
    }
    if(!gg && sz[u]*2>=n)flag=u;
}
int main(){
    scanf("%d",&n);
    rep(i,0,n-1){
        int a,b;
        scanf("%d%d",&a,&b);--a;--b;
        eg[a].pb(b);
        eg[b].pb(a);
    }
    dfs(0,-1);
    int c=flag;
    dfs(c,-1);
    int m=SZ(eg[c]);
    rep(i,0,SZ(eg[c]))bn[i]=sz[eg[c][i]];

    auto calc=[&](int a,int b) -> ll{
        ll t=comb.C(a,b);
        return t*t%mod * fac[b]%mod;
    };
    rep(i,0,bn[0]+1)dp[0][i]=calc(bn[0],i);
    int mx=bn[0]+1;
    rep(i,0,m-1){
        rep(j,0,mx)if(dp[i][j]){
            rep(k,0,bn[i+1]+1){
                add(dp[i+1][j+k],dp[i][j]*calc(bn[i+1],k)%mod);
            }
        }
        mx+=bn[i+1];
    }
    // OUT(mx);
    // assert(mx==n-1);
    ll ans=0;
    rep(i,0,mx){
        ll t=1;if(i&1)t=-1;
        ans+=t*dp[m-1][i]*fac[n-i]%mod;
    }
    ans%=mod;
    if(ans<0)ans+=mod;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 96896