//#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
// using namespace __gnu_pbds;
// template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;



#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define in insert
#define ld long double


#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define int ll
const ll mod =1e9+7;
const ll MAX_NODES =200001;
const ll MAX_LOG =50;
const ll maxn = 400000+10;
const ll md = (ll) 1e9 + 7;
 
inline ll add(ll a, ll b) {
  a += b;
  if (a >= md) a -= md;
  return a;
}
 
inline ll sub(ll a, ll b) {
  a -= b;
  if (a < 0) a += md;
  return a;
}
 
inline ll mul(ll a, ll b) {
  return (ll) ((long long) a * b % md);
}
 
inline ll power(ll a, long long b) {
  ll res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}
 
inline ll inv(ll a) {
  a %= md;
  if (a < 0) a += md;
  ll b = md, u = 0, v = 1;
  while (a) {
    ll t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}

vector<int> fact(maxn+5);
void init (int n)
{
  fact[0] = 1;
  for(int i = 1;i<=n;i++)
  {
    fact[i] = mul(i,fact[i-1]);
  }
}
int nck(int n,int k)
{
  return mul(fact[n],mul(inv(fact[k]),inv(fact[n-k])));
}
vl g[maxn+1];
int sz[maxn];
int dp[maxn];
int ans[maxn];
int n;
void dfs(int u,int p){
  dp[u] = 1;
  sz[u] = 1;
  for(auto v:g[u]){
    if(v!=p){
      dfs(v,u);
      dp[u] = mul(dp[u],mul(dp[v],inv(fact[sz[v]])));
      sz[u]+=sz[v];
    }
  }
  dp[u] = mul(dp[u],fact[sz[u]-1]);
  
}

void dfs2(int u , int p){
  ans[u] = dp[u];
  for(auto v:g[u]){
    if(v==p)
      continue;
    dp[u] = mul(dp[u],mul(fact[sz[v]],inv(dp[v])));
    dp[u] = mul(dp[u],inv(fact[sz[u]-1]));
    sz[u]-=sz[v];
    dp[u] = mul(dp[u],(fact[sz[u]-1]));
    dp[v] = mul(dp[v],mul(dp[u],inv(fact[sz[u]])));
    dp[v] = mul(dp[v],inv(fact[sz[v]-1]));
    sz[v]+=n-sz[v];
    dp[v] = mul(dp[v],(fact[sz[v]-1]));
    dfs2(v,u);
    dp[v] = mul(dp[v],inv(fact[sz[v]-1]));
    sz[v]-=sz[u];
    dp[v] = mul(dp[v],(fact[sz[v]-1]));
    dp[v] = mul(dp[v],mul(inv(dp[u]),(fact[sz[u]])));

    dp[u] = mul(dp[u],inv(fact[sz[u]-1]));
    sz[u]+=sz[v];
    dp[u] = mul(dp[u],(fact[sz[u]-1]));
    dp[u] = mul(dp[u],mul(inv(fact[sz[v]]),(dp[v])));
  }
}
int32_t main()
{

init(200001);
  cin>>n;
  for(int  i= 1;i<n;i++){
    int u,v;
    cin>>u>>v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1,0);
  ans[1] = dp[1];
  dfs2(1,0);
  for(int i= 1;i<=n;i++){
    cout<<ans[i]<<endl;
  }





}


Measured memory_bytes: 31472