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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using ll = long long;
using lb = long double;
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

struct mint {
    long long x;
public:
    mint(long long x=0) : x((x%mod+mod)%mod) {}
    mint operator-() const { 
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    bool operator <(const mint& r){return this->x<r.x;}
    bool operator ==(const mint& r){return this->x==r.x;}
    bool operator !=(const mint& r){return this->x!=r.x;}
    void operator++() {
        x++;
    }
    void operator--() {
        x--;
        if(x<0) x += mod;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

graph g;
mint permu[200005];
vector<mint> large;
vector<mint> part;
vector<mint> part2;
bool seen1[200005],seen2[200005];
ll N;

void dfs1(ll s){
  for(auto nx:g[s]){
    if(seen1[nx])continue;
    seen1[nx]=true;
    dfs1(nx);
    large[s] += large[nx];
  }
}

void dfs2(ll s){
  mint ret = 1;
  mint S = 0;
  for(auto nx:g[s]){
    if(seen2[nx]) continue;
    seen2[nx] = true;
    dfs2(nx);
    ret *= part[nx];
    S += large[nx];
    ret *= permu[large[nx].x].inv();
  }
  ret *= permu[S.x];
  part[s] = ret;
}

int main() {
  cin>>N;
  g.resize(N);
  large.assign(N,1);
  part.assign(N,1);
  rep(i,N-1){
    ll a,b;
    cin>>a>>b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  seen1[0] = seen2[0] = true;
  rep(i,200005){
    if(i==0) permu[i] = 1;
    else permu[i] = permu[i-1] * (mint)i;
  }
  dfs1(0);
  dfs2(0);
  vector<ll> root(N,-1);
  vector<ll> parent(N,-1);
  root[0] = 0;
  for(auto nx:g[0]){
    root[nx] = nx;
    parent[nx]=0;
    queue<ll> bfs;
    bfs.push(nx);
    while(!bfs.empty()){
      ll t = bfs.front();
      bfs.pop();
      for(auto nt:g[t]){
        if(root[nt]!=-1) continue;
        root[nt] = nx;
        parent[nt] = t;
        bfs.push(nt);
      }
    }
  }
  vector<mint> ans(N,-1);
  ans[0] = part[0];
  queue<ll> bfs;
  bfs.push(0);
  while(!bfs.empty()){
    ll t = bfs.front();
    bfs.pop();
    for(auto nx:g[t]){
      if(ans[nx]!=-1) continue;
      mint ret = ans[t];
      ret *= large[nx]*((mint)N-large[nx]).inv();
      ans[nx] = ret;
      bfs.push(nx);
    }
  }
  rep(i,N) cout<<ans[i]<<endl;
}

Measured memory_bytes: 27176