#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i=0; i<int(n); i++)
#define RNG(i, f, t) for(int i=int(f); i<=int(t); i++)
#define REV(i, f, t) for(int i=int(f); i>=int(t); --i)
#define ALL(v) (v).begin(), (v).end()
#define EXIT(answer) { cerr<<"EXIT #"<<__LINE__<<endl; cout<<answer<<endl; exit(0); }
#define sz(v) int(v.size())
bool RELAXED = false;
template<int,typename T> struct MINMAX{ T val; MINMAX(T val) : val(val) {} };
template<typename T> MINMAX<1,T> MAX(T val) { return MINMAX<1,T>(val); };
template<typename T> MINMAX<2,T> MIN(T val) { return MINMAX<2,T>(val); };
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<1,U> rhs) { return lhs = (rhs.val > lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<2,U> rhs) { return lhs = (rhs.val < lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T, typename U> istream& operator>>(istream& in, pair<T,U> &p) { in>>p.first>>p.second; return in; }
template<typename T> inline vector<T> READ(int n) { vector<T> vec(n); FOR(i,n) cin>>vec[i]; return vec; }
template<typename T> using min_heap = priority_queue<T, vector<T>, greater<T> >;
typedef signed long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

const int MOD = 1e9+7;
const int MAXN=2e5+5;
vpii dp[MAXN];
vpii pref[MAXN], suff[MAXN];
vvi adj(MAXN);
int fac[MAXN]={1};
int N;

ll inverseModulo(ll a, ll b){
    return 1<a ? b - inverseModulo(b % a, a) * b / a : 1;
}

void append(pii &a, pii b) {
    a.first = 1LL * a.first * b.first % MOD * inverseModulo(fac[b.second], MOD) % MOD;
    a.second += b.second;
}

pii dfs(int u, int p) {
    int ppos = lower_bound(ALL(adj[u]), p) - adj[u].begin();

    if(dp[u][ppos].first >= 0)
        return dp[u][ppos];

    if(pref[u][ppos-1].first < 0) {
        int idx = ppos;
        while(pref[u][idx-1].first < 0)
            idx--;
        RNG(i,idx,ppos-1) {
            auto rez = dfs(adj[u][i], u);
            pref[u][i] = pref[u][i-1];
            append(pref[u][i], rez);
        }
    }
    if(suff[u][ppos+1].first < 0) {
        int idx = ppos+1;
        while(suff[u][idx+1].first < 0)
            idx++;
        REV(i,idx,ppos+1) {
            auto rez = dfs(adj[u][i], u);
            suff[u][i] = suff[u][i+1];
            append(suff[u][i], rez);
        }
    }

    pii res;
    res.second = pref[u][ppos-1].second + suff[u][ppos+1].second;
    res.first = 1LL * pref[u][ppos-1].first * suff[u][ppos+1].first % MOD * fac[res.second] % MOD;
    res.second++;

    return dp[u][ppos]=res;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

    RNG(i,1,MAXN-1)
    	fac[i] = 1LL * i * fac[i-1] % MOD;

    cin>>N;
    FOR(i,N-1)
    {
        int a,b; cin>>a>>b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }

    RNG(u,1,N) {
    	adj[u].push_back(-1);
        sort(ALL(adj[u]));
        dp[u].resize(adj[u].size()+1, pii(-1,0));
        pref[u].resize(adj[u].size()+1, pii(-1,0));
        suff[u].resize(adj[u].size()+1, pii(-1,0));
        pref[u][0] = pii(1, 0);
        suff[u][adj[u].size()] = pii(1, 0);
    }

    RNG(u,1,N) {
        pii res = pii(1, 0);
        for(auto to : adj[u])
        	if(to >= 0)
        		append(res, dfs(to, u));
        res.first = 1LL * res.first * fac[res.second] % MOD;
        cout<<res.first<<endl;
    }

    return 0;
}



Measured memory_bytes: 54016