#include <iostream>
#include <vector>
#include <functional>
#include <cstdint>
using namespace std;
const int MOD = 1e9 + 7;
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 constexpr ostream &operator<<(ostream &os, const modint &x) noexcept
  {
    return os << x.a;
  }
};

using mint = modint<MOD>;
mint fact[200010], inv[200010], finv[200010];

void calcFact(int N = 200010)
{
  fact[0] = fact[1] = inv[1] = finv[1] = 1;
  for (int i = 2; i < N; i++)
  {
    inv[i] = 1;
    inv[i] /= i;
    fact[i] = fact[i - 1] * i;
    finv[i] = finv[i - 1] * inv[i];
  }
}

template <typename T>
struct ReRooting
{
  using F = function<T(T, int)>;
  using F2 = function<T(T, T)>;
  static const int MAX_V = 200010;
  int V;
  vector<int> E[MAX_V];
  vector<T> dp[MAX_V];
  //f(v) = g(merge(f(dp_c1,c1), f(dp_c2,c2), ..., f(dp_ck,ck)) , v)
  F f, g;
  F2 merge;
  T mi; //identity of merge

  ReRooting(int V_, F f_, F2 merge_, T mi_, F g_ = [](T a, int b) { return a; })
      : V(V_), f(f_), merge(merge_), mi(mi_), g(g_) {}

  void add_E(int a, int b)
  {
    E[a].push_back(b);
    E[b].push_back(a);
  }

  T dfs1(int p, int v)
  {
    T res = mi;
    for (int i = 0; i < E[v].size(); ++i)
    {
      if (E[v][i] == p)
        continue;
      dp[v][i] = dfs1(v, E[v][i]);
      res = merge(res, f(dp[v][i], E[v][i]));
    }
    return g(res, v);
  }

  void dfs2(int p, int v, T add)
  {
    for (int i = 0; i < E[v].size(); ++i)
    {
      if (E[v][i] == p)
      {
        dp[v][i] = add;
        break;
      }
    }

    vector<T> pL(E[v].size() + 1), pR(E[v].size() + 1);
    pL[0] = mi;
    for (int i = 0; i < E[v].size(); ++i)
      pL[i + 1] = merge(pL[i], f(dp[v][i], E[v][i]));
    pR[E[v].size()] = mi;
    for (int i = E[v].size(); i > 0; --i)
      pR[i - 1] = merge(pR[i], f(dp[v][i - 1], E[v][i - 1]));

    for (int i = 0; i < E[v].size(); ++i)
    {
      if (E[v][i] == p)
        continue;
      T val = merge(pL[i], pR[i + 1]);
      dfs2(v, E[v][i], g(val, v));
    }
  }

  void calc(int root = 0)
  {
    for (int i = 0; i < V; ++i)
      dp[i].resize(E[i].size());
    dfs1(-1, root);
    dfs2(-1, root, mi);
  }

  T solve(int v)
  {
    T ans = mi;
    for (int i = 0; i < E[v].size(); ++i)
      ans = merge(ans, f(dp[v][i], E[v][i]));
    return g(ans, v);
  }
};

int main()
{
  calcFact();
  int n;
  cin >> n;
  using P = pair<mint, int>;
  auto f = [&](P p, int v) {
    (void)v;
    return make_pair(p.first * finv[p.second], p.second);
  };
  auto merge = [&](P p1, P p2) {
    return make_pair(p1.first * p2.first, p1.second + p2.second);
  };
  auto g = [&](P p, int v) {
    (void)v;
    return make_pair(p.first * (fact[p.second]), p.second + 1);
  };
  ReRooting<P> re(n, f, merge, make_pair(1, 0), g);
  for (int i = 0; i < n - 1; ++i)
  {
    int x, y;
    cin >> x >> y;
    x--, y--;
    re.add_E(x, y);
  }
  re.calc();
  for (int i = 0; i < n; ++i)
    cout << re.solve(i).first << endl;
  return 0;
}


Measured memory_bytes: 40576