#include <bits/stdc++.h>
using namespace std;typedef long long ll;typedef vector<ll> vl;typedef vector<vl> vvl;typedef pair<ll,ll> pl;typedef vector<pl> vp;const ll INF=1001001001;const ll LINF=1001001001001001001;const ll D4[]={0,1,0,-1,0};const ll D8[]={0,1,1,0,-1,-1,1,-1,0};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;}
#define fore(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll mod = 1000000007;

template< int mod >
struct ModInt {
    int x;

    ModInt() : x(0) {}

    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

    ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
    }

    ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
    }

    ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
    }

    ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
    }

    ModInt operator-() const { return ModInt(-x); }

    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

    bool operator==(const ModInt &p) const { return x == p.x; }

    bool operator!=(const ModInt &p) const { return x != p.x; }

    ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
        t = a / b;
        swap(a -= t * b, b);
        swap(u -= t * v, v);
    }
    return ModInt(u);
    }

    ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
        if(n & 1) ret *= mul;
        mul *= mul;
        n >>= 1;
    }
    return ret;
    }

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

    friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
    }

    static int get_mod() { return mod; }
};

using modint = ModInt< mod >;

template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

template< typename T >
struct Combination {
  vector< T > _fact, _rfact, _inv;

  Combination(int sz) : _fact(sz + 1), _rfact(sz + 1), _inv(sz + 1) {
    _fact[0] = _rfact[sz] = _inv[0] = 1;
    for(int i = 1; i <= sz; i++) _fact[i] = _fact[i - 1] * i;
    _rfact[sz] /= _fact[sz];
    for(int i = sz - 1; i >= 0; i--) _rfact[i] = _rfact[i + 1] * (i + 1);
    for(int i = 1; i <= sz; i++) _inv[i] = _rfact[i] * _fact[i - 1];
  }

  inline T fact(int k) const { return _fact[k]; }

  inline T rfact(int k) const { return _rfact[k]; }

  inline T inv(int k) const { return _inv[k]; }

  T P(int n, int r) const {
    if(r < 0 || n < r) return 0;
    return fact(n) * rfact(n - r);
  }

  T C(int p, int q) const {
    if(q < 0 || p < q) return 0;
    return fact(p) * rfact(q) * rfact(p - q);
  }

  T H(int n, int r) const {
    if(n < 0 || r < 0) return (0);
    return r == 0 ? 1 : C(n + r - 1, r);
  }
};

vector<modint> dp;
vl cnt;
UnWeightedGraph g;
vector<modint> ans;
Combination<modint> comb(202020);
ll dfsCnt(ll x,ll p=-1){
    ll ret=1;
    for(ll to:g[x]){
        if(to==p)continue;
        ret+=dfsCnt(to,x);
    }
    return cnt[x]=ret;
}
modint dfs(ll x,ll p=-1){
    modint ret=comb.fact(cnt[x]-1);
    for(ll to:g[x]){
        if(to==p)continue;
        ret*=dfs(to,x);
        ret/=comb.fact(cnt[to]);
    }
    return dp[x]=ret;
}
void dfsAns(ll N,ll x,ll p=-1,modint pv=1){
  modint tmp=dp[x]*pv;
  tmp*=comb.C(N-1,N-cnt[x]);
  ans[x]=tmp;
  for(ll to:g[x]){
    if(to==p)continue;
    dfsAns(N,to,x,tmp/dp[to]/comb.C(N-1,N-cnt[to]-1));
  }
}
void solve(long long N, std::vector<long long> a, std::vector<long long> b){
    g=UnWeightedGraph(N);
    rep(i,N-1){
        g[a[i]-1].push_back(b[i]-1);
        g[b[i]-1].push_back(a[i]-1);
    }

    dp=vector<modint>(N);
    cnt=vl(N);
    ans=vector<modint>(N);
    dfsCnt(0);
    dfs(0);
    dfsAns(N,0);
    rep(i,N){
      cout<<ans[i]<<endl;
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(N-1);
    std::vector<long long> b(N-1);
    for(int i = 0 ; i < N-1 ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
    }
    solve(N, std::move(a), std::move(b));
}


Measured memory_bytes: 22516