#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int (i)=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1000000007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
  friend ostream& operator<<(ostream& os, const modint& m){
      os << m.a;
      return os;
  }
};

int N;
vector<vector<int>> G;
vector<modint<MOD>> dp, ep;
vector<int> sz;
vector<modint<MOD>> fac;


void dfs(int cur, int prv){
    int cnt = 1;
    modint<MOD> den = 1;
    modint<MOD> num = 1;
    for(int nxt : G[cur]){
        if(nxt == prv) continue;
        dfs(nxt, cur);
        cnt += sz[nxt];
        den = den * fac[sz[nxt]];
        num = num * dp[nxt];
    }
    sz[cur] = cnt;
    dp[cur] = fac[cnt-1] * num / den;
}

void efs(int cur, int prv){
    ep[cur] = dp[cur];
    for(int nxt : G[cur]){
        if(nxt == prv) continue;
        modint<MOD> dp_cur = dp[cur];
        dp_cur *= fac[sz[cur]-sz[nxt]-1] / fac[sz[cur]-1];
        dp_cur *= fac[sz[nxt]];
        dp_cur /= dp[nxt];
        dp[nxt] *= fac[N-1] / fac[sz[nxt]-1];
        dp[nxt] /= fac[sz[cur]-sz[nxt]];
        dp[nxt] *= dp_cur;
        sz[nxt] = N;
        efs(nxt, cur);
    }
}

int main(){
    cin >> N;
    G.resize(N);
    dp.resize(N);
    ep.resize(N);
    sz.resize(N);
    fac.resize(N+1);
    fac[0] = 1;
    for(int i=1; i<=N; i++) fac[i] = fac[i-1] * i;

    REP(i, N-1){
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    dfs(0, -1);
    efs(0, -1);

    for(int i=0; i<N; i++)
        cout << ep[i] << endl;
    return 0;
}

Measured memory_bytes: 19444