#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include //#include //#include //#include //#include //#include //#include //#include //#include //#if __cplusplus >= 201103L //#include //#include //#include //#include // //#define cauto const auto& //#else //#endif using namespace std; typedef long long ll; typedef pair pii; typedef pair pll; typedef vector vint; typedef vector > vvint; typedef vector vll, vLL; typedef vector > vvll, vvLL; #define VV(T) vector > template void initvv(vector > &v, int a, int b, const T &t = T()){ v.assign(a, vector(b, t)); } template void convert(const F &f, T &t){ stringstream ss; ss << f; ss >> t; } #define reep(i,a,b) for(int i=(a);i<(b);++i) #define rep(i,n) reep((i),0,(n)) #define ALL(v) (v).begin(),(v).end() #define PB push_back #define F first #define S second #define mkp make_pair #define RALL(v) (v).rbegin(),(v).rend() // #define DEBUG #ifdef DEBUG #define dump(x) cout << #x << " = " << (x) << endl; #define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; #else #define dump(x) #define debug(x) #endif #define MOD 1000000007LL #define EPS 1e-8 static const int INF=1<<24; vvll vv; int n,m; ll dp[2010][2010]; int used[2010]; ll tmp[2010]; int sz[2010]; ll add(ll a,ll b){ a%=MOD; b%=MOD; a+=b; a%=MOD; return a; } void foo2(int a,int n){ ll ret[2010]={}; rep(i,n){ rep(j,n){ if(i+j>=2010) break; ret[i+j]=add(ret[i+j],tmp[i]*dp[a][j]); } } rep(i,2010){ tmp[i]=ret[i]; } return; } void foo(int a){ // cout<>n>>m; vv=vvll(n); vector v(n-1); rep(i,n-1){ int a,b; cin>>v[i].F>>v[i].S; } queue q; q.push(0); while(q.size()){ int top=q.front(); q.pop(); rep(i,v.size()){ if(v[i].F==top){ q.push(v[i].S); vv[top].PB(v[i].S); v.erase(v.begin()+i); i--; } else if(v[i].S==top){ q.push(v[i].F); vv[top].PB(v[i].F); v.erase(v.begin()+i); i--; } } } foo(0); cout<