#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<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>;

const int MAX = 200100;
vector<mint> fac;

vector<vector<int>> to;
vector<mint> dp1;
vector<int> sub, tps;

mint dfs(int now, int prev) {
  int sz = 0;
  mint div = 1, com = 1;
  for (auto next : to[now]) {
    if (next == prev)
      continue;
    com *= dfs(next, now);
    sz += sub[next];
    div *= fac[sub[next]];
  }
  sub[now] = sz+1;
  tps.push_back(now);
  return dp1[now] = fac[sz]/div*com;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  to.resize(n);
  rep(i, n-1) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  fac.resize(MAX, 1);
  rep(i, MAX-1)
    fac[i+1] = fac[i]*(i+1);
  dp1.resize(n);
  sub.resize(n);
  dfs(0, -1);
  reverse(tps.begin(), tps.end());
  vector<mint> dp2(n, 1);
  vector<bool> used(n, false);
  rep(i, n) {
    int now = tps[i];
    used[now] = true;
    for (auto next : to[now]) {
      if (used[next])
        continue;
      dp2[next] = dp1[now]/fac[sub[now]-1]*fac[n-sub[next]-1]*fac[sub[next]]/fac[n-sub[now]]/dp1[next]*dp2[now]; 
    }
  }
  rep(i, n) {
    mint res = dp1[i]/fac[sub[i]-1]*fac[n-1]/fac[n-sub[i]]*dp2[i];
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 18036