#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using dijkstra = priority_queue<T, vector<T>, greater<T>>;

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define fbo find_by_order  // k th index
#define ook order_of_key   // strictly smaller than k
#define PI acos(-1.0)
#define inf 0x3f3f3f3f
#define max_ull 18446744073709551615
#define max_ll 9223372036854775807
#define lead_zero(x) __builtin_clzll(x)
#define trail_zero(x) __builtin_ctzll(x)
#define total_1s(x) __builtin_popcountll(x)
#define first_1(x) __builtin_ffsll(x)
#define log2_(x) __builtin_clz(1) - __builtin_clz(x)
#define isLeap(x) ((x % 400 == 0) || (x % 100 ? x % 4 == 0 : false))
#define QUERY           \
    int test;           \
    scanf("%d", &test); \
    for (int _T = 1; _T <= test; _T++)
#define FAST ios_base::sync_with_stdio(0), cin.tie(0)
#define all(v) v.begin(), v.end()
#define reunique(v) v.resize(std::unique(all(v)) - v.begin())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define ff first
#define ss second
#define MERGE(v1, v2, v) merge(all(v1), all(v2), back_inserter(v))
#define MP make_pair
#define EB emplace_back
#define read freopen("input.txt", "r", stdin)
#define write freopen("output.txt", "w", stdout)
#define in_range(v, r, l) upper_bound(all(v), r) - lower_bound(all(v), l)
#define LCM(a, b) (a / __gcd(a, b)) * b;

ll rdn(int y, int m, int d) {
    /* Rata Die day one is 0001-01-01 */
    if (m < 3)
        y--, m += 12;
    return 365 * y + y / 4 - y / 100 + y / 400 + (153 * m - 457) / 5 + d - 306;
}
/* Direction arrays */
/*int dx[] = {1,-1,0,0}, dy[] = {0,0,1,-1};                             */  // 4Direction
/*int dx[] = {1,-1,0,0,1,1,-1,-1}, dy[] = {0,0,1,-1,1,-1,1,-1};         */  // 8Direction
/* int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1};     */  // KnightDirection
/* int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1};                */  // HexagonalDirection
/* int day[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; */

const int mod=1e9+7;
const int N=2e5+9;

ll factorial[N];
ll mod_inv[N];

ll bigmod (ll a, ll e)
{
    ll ret = 1;
    while (e)
    {
        if (e & 1)
            ret *= a, ret %= mod;
        a *= a, a %= mod, e >>= 1;
    }
    return ret;
}

inline ll nCr(int x, int y)
{
    return factorial[x] * (mod_inv[y] * mod_inv[x - y] % mod) % mod;
}
vector<int>v[N];
ll dp[N];
ll ans[N];
ll _size[N];
ll dfs1(int x,int par){
    _size[x]=1;
    ll ansnow =1;
    for(int i:v[x]){
        if(i==par)continue;
        _size[x]+=dfs1(i,x);
        ansnow = (((ansnow*dp[i])%mod)*mod_inv[_size[i]])%mod;
    }
    ansnow = (ansnow*factorial[_size[x]-1])%mod;
    dp[x]=ansnow;
    return _size[x];
}

int n, a, b;
void dfs2(int x,int par,ll parans){
    ll ansnow = parans;
    if(x!=par){
        ansnow = (ansnow*bigmod(n-_size[x],mod-2))%mod;
        ansnow = (ansnow*mod_inv[_size[x]-1])%mod;
    }
    ans[x] = ansnow;
    for(int i:v[x]){
        if(i==par)continue;
        dfs2(i,x,(ans[x]*factorial[_size[i]])%mod);
    }
    return;
}

int main()
{
    factorial[0]=1;
    for(int i=1; i<N; ++i)
        factorial[i]=(i*1LL*factorial[i-1])%mod;

    mod_inv[N-1]=bigmod(factorial[N-1],mod-2);
    for(ll i=N-1; i>0; --i)
        mod_inv[i-1]=(i*1LL*mod_inv[i])%mod;
    
    scanf("%d",&n);
    for(int i=1;i<n;i++){
        scanf("%d %d",&a,&b);
        v[a].EB(b);
        v[b].EB(a);
    }
    dfs1(1,0);
    dfs2(1,1,dp[1]);
    for(int i=1;i<=n;i++){
        cout<<ans[i]<<"\n";
    }
}


Measured memory_bytes: 21748