#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

template<class T> class ReRooting {
  vector<T> res;
public:
  ReRooting(int n, vector<vector<int>> &_to, T identity, function<T(T, int)> trans, function<T(T, T)> merge) {
    res.resize(n);
    if (n == 1) {
      res[0] = trans(identity, 0);
      return;
    }
    vector<vector<int>> to(n), idx(n);
    for (int x = 0; x < n; x++) {
      for (int i = 0; i < _to[x].size(); i++) {
        int y = _to[x][i];
        if (x >= y)
          continue;
        idx[x].push_back(to[y].size());
        idx[y].push_back(to[x].size());
        to[x].push_back(y);
        to[y].push_back(x);
      }
    }
    vector<vector<T>> dp(n);
    for (int i = 0; i < n; i++)
      dp[i].resize(to[i].size());
    vector<int> ord = {0}, par(n);
    par[0] = -1;
    stack<int> st;
    st.push(0);
    while (!st.empty()) {
      int cur = st.top();
      st.pop();
      for (auto next : to[cur]) {
        if (next == par[cur])
          continue;
        par[next] = cur;
        ord.push_back(next);
        st.push(next);
      }
    }
    for (int i = n - 1; i > 0; i--) {
      int cur = ord[i], par_idx;
      T accum = identity;
      for (int j = 0; j < to[cur].size(); j++) {
        if (to[cur][j] == par[cur])
          par_idx = j;
        else
          accum = merge(accum, dp[cur][j]);
      }
      dp[par[cur]][idx[cur][par_idx]] = trans(accum, cur);
    }
    for (int i = 0; i < n; i++) {
      int cur = ord[i];
      vector<T> r_accum(to[cur].size());
      r_accum.back() = identity;
      for (int j = (int)r_accum.size() - 1; j > 0; j--)
        r_accum[j-1] = merge(r_accum[j], dp[cur][j]);
      T l_accum = identity;
      for (int j = 0; j < r_accum.size(); j++) {
        T accum = merge(l_accum, r_accum[j]);
        dp[to[cur][j]][idx[cur][j]] = trans(accum, cur);
        l_accum = merge(l_accum, dp[cur][j]);
      }
      res[cur] = l_accum;
    }
  }
  T query(int root) {
    return res[root];
  }
};

template<int Mod> class ModInt {
  int v;
public:
  constexpr ModInt(const long long x = 0) noexcept : v((x % Mod + Mod) % Mod) {};
  constexpr ModInt &operator+=(const ModInt rhs) noexcept {
    v += rhs.v;
    if (v >= Mod)
      v -= Mod;
    return *this;
  }
  constexpr ModInt &operator-=(const ModInt rhs) noexcept {
    if (v < rhs.v)
      v += Mod;
    v -= rhs.v;
    return *this;
  }
  constexpr ModInt &operator*=(const ModInt rhs) noexcept {
    v = int(1LL * v * rhs.v % Mod);
    return *this;
  }
  constexpr ModInt &operator/=(ModInt rhs) noexcept {
    long long exp = Mod - 2;
    while (exp) {
      if (exp & 1)
        *this *= rhs;
      rhs *= rhs;
      exp >>= 1;
    }
    return *this;
  }
  constexpr ModInt operator-() const noexcept { return ModInt(-v); }
  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 bool operator==(const ModInt rhs) const noexcept {
    return v == rhs.v;
  }
  constexpr bool operator!=(const ModInt rhs) const noexcept {
    return v != rhs.v;
  }
  constexpr ModInt pow(long long exp) const noexcept {
    ModInt res(1), mul(v);
    while (exp) {
      if (exp & 1)
        res *= mul;
      mul *= mul;
      exp >>= 1;
    }
    return res;
  }
  friend ostream &operator<<(ostream &os, const ModInt obj) noexcept {
    return os << obj.v;
  }
  friend istream &operator>>(istream &is, ModInt &obj) noexcept {
    long long tmp;
    is >> tmp;
    obj = ModInt<Mod>(tmp);
    return is;
  }
};
constexpr int MOD = 1000000007;
using mint = ModInt<MOD>;

struct Data {
  mint dp;
  int sub;
};

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0); 
  int n;
  cin >> n;
  vector<vector<int>> to(n);
  rep(i, n-1) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  vector<mint> fact(n+1), invf(n+1);
  fact[0] = 1;
  rep(i, n)
    fact[i+1] = fact[i]*(i+1);
  invf[n] = mint(1)/fact[n];
  for (int i = n; i > 0; i--)
    invf[i-1] = invf[i]*i;
  ReRooting<Data> res(n, to, Data({1, 0}), [](auto x, auto y) {
    return Data({x.dp, x.sub+1});
  }, [&](auto x, auto y) {
    int sum = x.sub+y.sub;
    return Data({x.dp*y.dp*invf[x.sub]*invf[y.sub]*fact[sum], sum});
  });
  rep(i, n)
    cout << res.query(i).dp << endl;
  return 0;
}

Measured memory_bytes: 55284