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

// macros
#define int long long 
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define all(c) c.begin(), c.end()
#define PB push_back
#define MP make_pair
#define bitcount __builtin_popcount
#define watch(x) cerr<< (#x) << " is " << (x) <<"\n";
#define sz(x) ((int)((x).size()))
#define UNIQUE(c) (c).resize(unique(all(c)) - (c).begin())
#define pii2ll(p) ((ll)(p).first<<32 | (p).second)

// type definitions
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vi > vvi;
typedef pair<int, int> pii;
typedef long double ld;

// template functions
template < typename A, typename B >
ostream &operator << ( ostream& os, const pair< A, B > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}
template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "[";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}
template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "{";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}
template < typename A, typename B >
ostream &operator << ( ostream & os, const map< A, B > &v ) {
    os << "[";
    typename map< A, B >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " -> " << it -> second ;
    }
    return os << "]";
}
template<typename T>
T gcd(T a, T b) { if(a==0 or b==0) return a+b; return gcd(b, a%b) ; }
template<typename T>
T lcm(T a, T b) { if(a==0 or b==0) return 0; return a/gcd(a, b)*b; }

// random number generation
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// constants
const long double eps = LDBL_EPSILON;
const int inf = 1e15;
const int modn = 1e9+7;
const int maxn = 2e5+3;

inline int add(int a, int b) { int ret=((ll)a+b)%modn; if(ret<0) ret+=modn; return ret; }
inline int mul(int a, int b) { int ret=((ll)a*b)%modn; if(ret<0) ret+=modn; return ret; }
template<typename... Args>
inline int add(int a, Args... args) { return add(a, add(args...)); }
template<typename... Args>
inline int mul(int a, Args... args) { return mul(a, mul(args...)); }
inline int addm(int a, int b, int MOD) { int ret=((ll)a+b)%MOD; if(ret<0) ret+=MOD; return ret; }
inline int mulm(int a, int b, int MOD) { int ret=((ll)a*b)%MOD; if(ret<0) ret+=MOD; return ret; }
inline int addm(int a, int b, int c, int MOD) { return addm(a, addm(b, c, MOD), MOD); }
inline int mulm(int a, int b, int c, int MOD) { return mulm(a, mulm(b, c, MOD), MOD); }
int po(int a, int b) {int res=1; for(; b>0; a=mul(a,a), b>>=1) if(b&1) res=mul(res,a); return res; }
inline int inv(int a) {return po(a, modn-2);}
inline int divi(int a, int b) {return mul(a, inv(b));}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // Your code here
    vi fact(maxn);
    fact[0] = 1;
    for(int i=1; i<maxn; i++) {
        fact[i] = mul(i, fact[i-1]);
    }
    int n;
    cin>>n;
    vvi adj(n);
    for(int i=0; i<n-1; i++) {
        int u, v;
        cin>>u>>v;
        u--, v--;
        adj[u].PB(v);
        adj[v].PB(u);
    }
    vi f1(n, 1), f2(n, 1), ans(n), siz(n, 1), P(n, 1), Psiz(n, 1);
    function<void(int, int)> dfs = [&](int u, int pr) {
        for(int v : adj[u]) {
            if(v==pr) continue;
            dfs(v, u);
            siz[u] += siz[v];
            P[u] = mul(P[u], f1[v]);
            Psiz[u] = mul(Psiz[u], fact[siz[v]]);
        }
        f1[u] = mul(fact[siz[u]-1], inv(Psiz[u]), P[u]);
    };
    dfs(0, -1);
    function<void(int, int)> dfs2 = [&](int u, int pr) {
        ans[u] = mul(fact[n-1], inv(Psiz[u]), inv(fact[n-siz[u]]), P[u], f2[u]);
        for(int v : adj[u]) {
            if(v==pr) continue;
            // f2[v] = mul(f2[u], divi(P[u], f1[v]));
            // f2[v] = mul(f2[v], fact[n-siz[v]-1]);
            // f2[v] = mul(f2[v], divi(fact[siz[v]], Psiz[u]));
            // f2[v] = divi(f2[v], fact[n-siz[u]]);
            // f2[v] = mul(f2[v], f2[u]);
            f2[v] = mul(fact[n-siz[v]-1], fact[siz[v]], P[u], f2[u], inv(mul(Psiz[u], fact[n-siz[u]], f1[v])));
            dfs2(v, u);
        }
    };
    dfs2(0, -1);
    for(int i=0; i<n; i++) {
        cout << ans[i] << "\n";
    }
    return 0;
}



Measured memory_bytes: 25712