#include <bits/stdc++.h>
using namespace std;
 
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

 
void solve(){
 
 
}

const ll mod=1e9+7;
const int maxn = 200009;
vi f, invf;
ll modpow(ll b, ll e) {
	ll ans = 1;
	for (; e; b = b * b % mod, e /= 2)
		if (e & 1) ans = ans * b % mod;
	return ans;
}
vector<ll > inv;
ll modi(ll x){
    return modpow(x, mod-2);
}
void pre(){
    inv.resize(maxn,1);
    f.resize(maxn,1);
    invf.resize(maxn,1);
    repA(i,2,maxn-1) inv[i] = mod - (mod / i) * inv[mod % i] % mod;
    ll p=1;
    repA(i,2,maxn-1) p=p*i%mod, f[i]=p,invf[i]=modi(p);
}

int cn(int n, int k){
    if(n<0||k<0||n<k) return 0;
    return f[n]*invf[k]%mod*invf[n-k]%mod;
}

int n;
vi g[200009], s;
map<int, ll > dp[200009];
ll dfs0(int u,int p){
    ll a=1;
    trav(v,g[u])if(v!=p)a+=dfs0(v,u);
    return s[u]=a;
}
ll dfs(int u, int p){
    ll a=f[s[u]-1];
    trav(v, g[u])if(v!=p) a=a*dfs(v,u)%mod*invf[s[v]]%mod;
    return dp[u][p]=a;
}
void dfs1(int u,int p){
    ll a=1;
    trav(v,g[u])if(v!=p) a=a*dp[v][u]%mod*invf[s[v]]%mod;
    if(p!=-1){
        a=a*f[n-1]%mod;
        dp[u][-1]=a=a*dp[p][u]%mod*invf[n-s[u]]%mod;
        a=a*invf[n-1]%mod;
    }
    trav(v,g[u])if(v!=p){
        a=a*f[n-s[v]-1]%mod;
        a=a*modi(dp[v][u])%mod*f[s[v]]%mod;
        dp[u][v]=a;
        a=a*dp[v][u]%mod*invf[s[v]]%mod;
        a=a*invf[n-s[v]-1]%mod;
    }
    trav(v,g[u])if(v!=p) dfs1(v,u);
}


int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	pre();

    cin>>n;
    s.resize(n,0);
    rep(i,n-1){
        int u,v;cin>>u>>v;u--,v--;
        g[u].pb(v), g[v].pb(u);
    }
    dfs0(0,-1);
    dfs(0,-1);
    dfs1(0,-1);
    rep(i,n)cout<<dp[i][-1]<<'\n';

	return 0;
}
 



Measured memory_bytes: 64756