#include #include #include #include #include #include #include using namespace std; #define int long long #define rep(i,n) for(int i = 0; i < (n); i++) #define INF ((long long)1e18) #define MOD ((int)1e9+7) #define endl "\n" #define yn(f) ((f)?"Yes":"No") #define YN(f) ((f)?"YES":"NO") #define MAX 210000 long long fac[MAX], mmi[MAX]; int used[MAX], temp[MAX]; int N; const int MAX_VAL = MAX; vector G[MAX]; void factorial_mod(int Z){ fac[0]=fac[1]=1; for(long long i = 2; i < Z; fac[i]%=MOD,i++) fac[i] = fac[i-1]*(i%MOD); } long long power_mod(long long x, long long n){ long long ans = 1; for(;n;n>>=1,x*=x,ans%=MOD,x%=MOD) if(n&1)ans*=x; return ans%MOD; } void exgcd(int a, int b, int &x, int &y){ if(b == 0){ x = 1; y = 0; return ; } exgcd(b,a%b,y,x); y -= a/b * x; } void modular_multiplicatibe_inverse(int Z){ int x, y; exgcd(fac[Z-1],MOD,x,y); mmi[Z-1] = x; for(long long i = Z-2; i >= 0; mmi[i]%=MOD,i--) mmi[i] = mmi[i+1]*((i+1)%MOD); } long long combination(long long n, long long r){ return fac[n]*(mmi[r]*mmi[n-r]%MOD)%MOD; } void dfs(int depth = 0, int num = 1){ if(used[num]) return; used[num] = true; temp[depth]++; for(int i = 0; i < G[num].size(); i++){ if(used[G[num][i]]) continue; dfs(depth+1, G[num][i]); } } void bfs(){ queue Q; Q.push(1); used[1] = 1; while(!Q.empty()){ int num = Q.front(); Q.pop(); temp[used[num]-1]++; for(int i = 0; i < G[num].size(); i++){ if(used[G[num][i]]) continue; if(!used[G[num][i]]){ Q.push(G[num][i]); used[G[num][i]] = used[num] + 1; } } } } signed main(){ cin.tie(0); ios::sync_with_stdio(false); cout<>N; factorial_mod(N+10); modular_multiplicatibe_inverse(N+10); for(int i = 0; i < N-1; i++){ cin>>u>>v; G[u].push_back(v); G[v].push_back(u); } bfs(); for(int i = 0; i < N; i++){ // cout<