#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x;
  mint(ll 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 { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  // 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 { return mint(*this) /= a;}
  bool operator==(const mint rhs) const { return x == rhs.x; }
  bool operator!=(const mint rhs) const { return x != rhs.x; }
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

template <typename T>
struct ReRooting {
  private:
    using F = function<T(T,int,int)>; //(dp,v,i):dpの更新
    using F2 = function<T(T,int)>;
    using H = function<T(T,T)>;
    int n;
    const vector<vector<int> > G;
    vector<vector<T> > dp;
    vector<T> ans;
    //dp_v = g(combine(f(dp_u1,u1), f(dp_u2,u2), ..., f(dp_uk,uk)), v)
    const F f;
    const H combine;
    const T NE; //neutral of combine
    const F2 g;

    T dfs1(int v, int p = -1) {
      T res = NE;
      dp[v].assign(G[v].size(), NE);
      for (int i = 0; i < (int)G[v].size(); ++i) {
        int to = G[v][i];
        if (to == p) continue;
        dp[v][i] = dfs1(to, v);
        res = combine(res, f(dp[v][i], v, i));
      }
      return g(res,v);
    }
    void dfs2(int v, const T& pre, int p = -1) {
      int m = G[v].size();
      for (int i = 0; i < m; ++i){
        if (G[v][i] == p) {
          dp[v][i] = pre; break;
        } 
      }
      vector<T> dp_l(G[v].size()+1,NE), dp_r(G[v].size()+1,NE); //累積combine
      for (int i = 0; i < m; ++i) {
        dp_l[i+1] = combine(dp_l[i], f(dp[v][i], v, i));
      }
      for (int i = G[v].size(); i > 0; --i) {
        dp_r[i-1] = combine(dp_r[i], f(dp[v][i-1], v, i-1));
      }
      ans[v] = g(dp_l[m], v); //頂点vの答え
      for (int i = 0; i < m; ++i) {
        int to = G[v][i];
        if (to == p) continue;
        dfs2(to, g(combine(dp_l[i], dp_r[i+1]), v), v);
      }
    }
  public:
    ReRooting(const vector<vector<int> >& G, const F &f, const H &combine, T ne, 
    F2 g=[](T a, int b){ return a;}): G(G),f(f),combine(combine),NE(ne),g(g) {
      n = G.size();
      dp.resize(n);
      ans.assign(n,NE);
    }
    void build(int root = 0) {
      dfs1(root);
      dfs2(root, NE);
    }
    T operator[](const int &v) const{
      assert(v < n);
      return ans[v];
    }
};

const ll MOD = 1000000007;

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  ll n;
  cin >> n;
  vector<vector<int> > G(n);
  rep(i,n-1) {
    int a,b;
    cin >> a >> b;
    a--; b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }
  combination comb(n);
  using P = pair<mint, int>;

  auto combine = [](P a, P b){ 
    return P(a.first*b.first, a.second+b.second);
  };
  auto f = [&](P a, int v, int i){ return P(a.first/comb.fact[a.second], a.second);};
  auto g = [&](P a, int v){ return P(a.first*comb.fact[a.second], a.second+1);};
  ReRooting<P> RR(G, f, combine, P(1,0), g);
  RR.build();
  rep(i,n) {
    cout << RR[i].first << "\n";
  }
  return 0;
}

Measured memory_bytes: 50292