#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;

int add(int a, int b){
    return (a+b)%MOD;
}

int mul(int a, int b){
    return (1LL*a*b)%MOD;
}

int pw(int a, int b){
    if(b == 0) return 1;
    int res = pw(a, b/2);
    res = mul(res, res);
    if(b%2) res = mul(res, a);
    return res;
}

vector <int> prvo[400005];
vector <int> graf[400005];
int dole[400005];
int par[400005];
vector <pair <int, int>> pre[400005];
vector <pair <int, int>> suf[400005];
int sz[400005];

int fak[400005];
int invfak[400005];

int bin(int n, int k){
    if(n < 0 || k < 0 || n < k) return 0;
    int res = fak[n];
    res = mul(res, invfak[k]);
    res = mul(res, invfak[n-k]);
    return res;
}

void dfs_dole(int v, int parent){
    dole[v] = 1;
    par[v] = parent;
    sz[v] = 1;
    vector <pair <int, int>> vec;
    for(auto c : graf[v]){
        if(c == parent) continue;
        dfs_dole(c, v);
        sz[v] += sz[c];
        vec.push_back({dole[c], sz[c]});
    }
    int k = vec.size();
    if(!k) return;
    for(int i=0; i<k; i++){
        pre[v].push_back({0, 0});
        suf[v].push_back({0, 0});
    }
    pre[v][0] = vec[0];
    suf[v][k-1] = vec[k-1];
    //cout << vec[0].first << " " << vec[0].second << endl;
    for(int i=1; i<k; i++){
        pre[v][i].second = pre[v][i-1].second + vec[i].second;
        pre[v][i].first = mul(mul(pre[v][i-1].first, vec[i].first), bin(pre[v][i-1].second+vec[i].second, vec[i].second));
    }
    if(k) dole[v] = pre[v][k-1].first;
    for(int i=k-2; i>=0; i--){
        suf[v][i].second = suf[v][i+1].second + vec[i].second;
        suf[v][i].first = mul(mul(suf[v][i+1].first, vec[i].first), bin(suf[v][i+1].second+vec[i].second, vec[i].second));
    }
}

pair <int, int> treng;

int resenje[200005];

void dfs(int v, int parent){
    resenje[v] = mul(mul(dole[v], treng.first), bin(treng.second+sz[v]-1, sz[v]-1));
    pair <int, int> ot = treng;
    int k = graf[v].size();
    for(int i=0; i<k; i++){
        if(graf[v][i] == parent) continue;
        treng = ot;
        if(i > 0){
            treng.first = mul(mul(treng.first, pre[v][i-1].first), bin(treng.second+pre[v][i-1].second, treng.second));
            treng.second += pre[v][i-1].second;
        }
        if(i < k-1){
            treng.first = mul(mul(treng.first, suf[v][i+1].first), bin(treng.second+suf[v][i+1].second, treng.second));
            treng.second += suf[v][i+1].second;
        }
        treng.second++;
        dfs(graf[v][i], v);
    }
}

void dfs_prav(int v, int parent){
    for(auto c : prvo[v]){
        if(c == parent) continue;
        graf[v].push_back(c);
        dfs_prav(c, v);
    }
}

int main(){
    ios_base::sync_with_stdio(false), cin.tie(0);
    cout.precision(10);
    cout << fixed;

	int n;
	cin >> n;
	fak[0] = 1;
	invfak[0] = pw(1, MOD-2);
	for(int i=1; i<=2*n; i++){
        fak[i] = mul(i, fak[i-1]);
        invfak[i] = pw(fak[i], MOD-2);
	}
	for(int i=1; i<n; i++){
        int a, b;
        cin >> a >> b;
        prvo[a].push_back(b);
        prvo[b].push_back(a);
	}
	dfs_prav(1, 0);
	dfs_dole(1, 0);
	treng = {1, 0};
	dfs(1, 0);
	for(int i=1; i<=n; i++) cout << resenje[i] << "\n";
    return 0;
}


Measured memory_bytes: 67200