#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
using namespace std;

#include <iostream>
using namespace std;
typedef long long ll;

#ifdef MUTABLE
int mod;
#else
template<int mod>
#endif
struct ModInt {
  int val;
  ModInt inv() const{
    int tmp,a=val,b=mod,x=1,y=0;
    while(b)tmp=a/b,a-=tmp*b,swap(a,b),x-=tmp*y,swap(x,y);
    return ModInt(x);
  }
  ModInt():val(0){}
  ModInt(ll x){if((val=x%mod)<0)val+=mod;}
  ModInt pow(ll t){ModInt res=1,b=*this; while(t){if(t&1)res*=b;b*=b;t>>=1;}return res;}
  ModInt& operator+=(const ModInt& x){if((val+=x.val)>=mod)val-=mod;return *this;}
  ModInt& operator-=(const ModInt& x){if((val+=mod-x.val)>=mod)val-=mod; return *this;}
  ModInt& operator*=(const ModInt& x){val=(ll)val*x.val%mod; return *this;}
  ModInt& operator/=(const ModInt& x){return *this*=x.inv();}
  bool operator==(const ModInt& x) const{return val==x.val;}
  bool operator!=(const ModInt& x) const{return val!=x.val;}
  bool operator<(const ModInt& x) const{return val<x.val;}
  bool operator<=(const ModInt& x) const{return val<=x.val;}
  bool operator>(const ModInt& x) const{return val>x.val;}
  bool operator>=(const ModInt& x) const{return val>=x.val;}
  ModInt operator+(const ModInt& x) const{return ModInt(*this)+=x;}
  ModInt operator-(const ModInt& x) const{return ModInt(*this)-=x;}
  ModInt operator*(const ModInt& x) const{return ModInt(*this)*=x;}
  ModInt operator/(const ModInt& x) const{return ModInt(*this)/=x;}
  friend ostream& operator<<(ostream& os, const ModInt& mi) { os << mi.val; return os; }
  static int get_mod() { return mod; }
};

#ifndef MUTABLE
using modint = ModInt<1000000007>;
#endif

template <int mod>
struct Factorial {
  using mint = ModInt<mod>;
  vector<mint> Fact, Finv;
public:
  Factorial(int _n): Fact(_n+1), Finv(_n+1) {
      Fact[0]=mint(1); for (int i = 0; i < _n; ++i) Fact[i+1]=Fact[i]*(i+1);
      Finv[_n]=mint(1)/Fact[_n]; for (int i = _n; i > 0; --i) Finv[i-1]=Finv[i]*i;
  }
  mint fact(int n,bool inv=0) { if (inv) return Finv[n]; else return Fact[n]; }
  mint nPr(int n,int r){ if (n<0||n<r||r<0) return mint(0); else return Fact[n]*Finv[n-r]; }
  mint nCr(int n,int r){ if (n<0||n<r||r<0) return mint(0); else return Fact[n]*Finv[r]*Finv[n-r]; }
};

using factorial = Factorial<1000000007>;

#include <vector>

template< typename T >
struct Edge {
  int from, to;
  T cost;
  Edge() {}
  Edge(int f, int t) : from(f), to(t), cost(1) {}
  Edge(int f, int t, T c) : from(f), to(t), cost(c) {}
  friend bool operator < (const Edge& lhs, const Edge& rhs) { return lhs.cost < rhs.cost; };
  friend bool operator > (const Edge& lhs, const Edge& rhs) { return rhs < lhs; };
  friend bool operator <= (const Edge& lhs, const Edge& rhs) { return !(lhs > rhs); };
  friend bool operator >= (const Edge& lhs, const Edge& rhs) { return !(lhs < rhs); };
};

template< typename T >
using Edges = std::vector< Edge< T > >;
template< typename T >
using Graph = std::vector< Edges< T > >;

int childs[200000];
factorial f(200010);
modint dp1[200010];
modint dp2[200010];
int n;

pair<modint,int> dfs(Graph<int> &g, int s, int par) {
  modint ret = 1;
  int nc = 0;
  int i = 0;
  for (auto &e : g[s]) {
    int t = e.to;
    if (t == par) continue;
    auto p = dfs(g, t, s);
    ret *= p.first;
    nc += p.second;
    if (i > 0) ret *= f.nCr(nc,p.second);
    ++i;
  }
  // cerr << "[!]" <<  s << " " << nc << " " << c << " " << ret << endl;
  childs[s] = nc;
  dp1[s] = ret;
  return {ret, nc+1};
}

void dfs2(Graph<int> &g, int s, int par) {
  if (s == par) {
    dp2[s] = dp1[s];
  }
  else {
    int c = childs[s];
    // cerr << s << " " << c << " " << dp1[s] << " " << dp1[par] << " " << f.nCr(n-1,c) << " " << f.nCr(n-1,c+1) << endl;
    modint ret = dp2[par]*f.nCr(n-1,c)/f.nCr(n-1,c+1);
    dp2[s] = ret;
  }
  for (auto &e : g[s]) {
    int t = e.to;
    if (t == par) continue;
    dfs2(g, t, s);
  }
}

typedef long long ll;
int main() {
  cin >> n;
  Graph<int> g(n);
  for (int i = 0; i < n-1; ++i) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    g[a].emplace_back(a, b);
    g[b].emplace_back(b, a);
  }
  auto p = dfs(g, 0, 0);
  dfs2(g, 0, 0);
  for (int i = 0; i < n; ++i) {
    cout << dp2[i] << endl;
  }
}


Measured memory_bytes: 20096