#include <bits/stdc++.h>
using namespace std;

string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define DEBUG(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

template <class T, class Op = multiplies<T>>
T power(T a, long long n, Op op = multiplies<T>(), T e = {1}) {
  assert(n >= 0);
  while (n) {
    if (n & 1) e = op(e, a);
    if (n >>= 1) a = op(a, a);
  }
  return e;
}

template <unsigned M> struct modular {
  using m = modular;
  unsigned v;
  modular(long long x = 0) : v((x %= M) < 0 ? x + M : x) {}
  m operator-() const { return m() -= *this; }
  m& operator+=(m b) { if ((v += b.v) >= M) v -= M; return *this; }
  m& operator-=(m b) { if (v < b.v) v += M; v -= b.v; return *this; }
  m& operator*=(m b) { v = (uint64_t)v * b.v % M; return *this; }
  m& operator/=(m b) { return *this *= power(b, M - 2); }
  friend m operator+(m a, m b) { return a += b; }
  friend m operator-(m a, m b) { return a -= b; }
  friend m operator*(m a, m b) { return a *= b; }
  friend m operator/(m a, m b) { return a /= b; }
  friend bool operator==(m a, m b) { return a.v == b.v; }
  friend string to_string(m a) { return to_string(a.v); }
};

constexpr long long mod = 1e9 + 7;
using mint = modular<mod>;

vector<mint> fact, inv_fact, minv;
void prepare(int n) {
  fact.resize(n + 1), inv_fact.resize(n + 1), minv.resize(n + 1);
  for (int i = 0; i <= n; ++i) fact[i] = i ? i * fact[i - 1] : 1;
  inv_fact[n] = power(fact[n], mod - 2);
  for (int i = n; i; --i) inv_fact[i - 1] = inv_fact[i] * i;
  for (int i = 1; i <= n; ++i) minv[i] = fact[i - 1] * inv_fact[i];
}
mint binom(int n, int k) {
  if (k < 0 or k > n) return 0;
  return fact[n] * inv_fact[k] * inv_fact[n - k];
}
template<> mint& mint::operator/=(mint r) {
  return *this *= r.v < minv.size() ? minv[r.v] : power(r, mod - 2);
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  prepare(n);
  vector<vector<int>> g(n);
  for (int _ = n - 1; _--; ) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  auto mrg = [](int szv, mint dpv, int szu, mint dpu) {
    return dpv * dpu * binom(szv + szu - 1, szu);
  };
  auto smrg = [](int szv, mint dpv, int szu, mint dpu) {
    return dpv * dpu * binom(szv + szu, szu);
  };
  vector<int> sz(n);
  vector<mint> dp(n);
  {
    auto dfs = [&](auto&& self, int v, int p) -> void {
      sz[v] = 1;
      dp[v] = 1;
      for (int u : g[v]) {
        if (u != p) {
          self(self, u, v);
          dp[v] = mrg(sz[v], dp[v], sz[u], dp[u]);
          sz[v] += sz[u];
        }
      }
    };
    dfs(dfs, 0, -1);
  }
  DEBUG(dp);
  vector<mint> pdp(n);
  {
    auto dfs = [&](auto&& self, int v, int p) -> void {
      mint cur = p != -1 ? pdp[v] : 1;
      int m = g[v].size();
      vector<mint> l(m + 1), r(m + 1);
      vector<int> lsz(m + 1), rsz(m + 1);
      l[0] = 1;
      for (int i = 0; i < m; ++i) {
        if (g[v][i] != p) {
          l[i + 1] = smrg(lsz[i], l[i], sz[g[v][i]], dp[g[v][i]]);
          lsz[i + 1] = lsz[i] + sz[g[v][i]];
        } else {
          l[i + 1] = l[i];
          lsz[i + 1] = lsz[i];
        }
      }
      r[m] = 1;
      for (int i = m; i--; ) {
        if (g[v][i] != p) {
          r[i] = smrg(sz[g[v][i]], dp[g[v][i]], rsz[i + 1], r[i + 1]);
          rsz[i] = sz[g[v][i]] + rsz[i + 1];
        } else {
          r[i] = r[i + 1];
          rsz[i] = rsz[i + 1];
        }
      }
      if (v == 0) {
        DEBUG(lsz);
        DEBUG(rsz);
        DEBUG(l);
        DEBUG(r);
      }
      DEBUG(v, cur);
      for (int i = 0; i < m; ++i) {
        if (g[v][i] != p) {
          pdp[g[v][i]] = mrg(n - sz[v] + 1, cur, lsz[i], l[i]);
          pdp[g[v][i]] = mrg(n - sz[v] + 1 + lsz[i], pdp[g[v][i]], rsz[i + 1], r[i + 1]);
          self(self, g[v][i], v);
        }
      }
    };
    dfs(dfs, 0, -1);
  }
  DEBUG(pdp);
  for (int v = 0; v < n; ++v) {
    if (v == 0) {
      cout << dp[0].v << '\n';
    } else {
      cout << mrg(sz[v], dp[v], n - sz[v], pdp[v]).v << '\n';
    }
  }
}


Measured memory_bytes: 19828