#include <bits/stdc++.h>

#define REP(i, n) for (int i = 0; i < (int)(n); ++i)

using namespace std;

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

const int kMax = 2 * 1e5;
const int kMod = 1e9 + 7;

typedef modint<kMod> mint;

int N;

mint factorial[kMax];

int subtree_size[kMax];

int subtreeSize(int node, int parent, const vector<vector<int>>& edges) {
  int sum = 1;
  for (int child : edges[node]) {
    if (child == parent) {
      continue;
    }
    sum += subtreeSize(child, node, edges);
  }
  subtree_size[node] = sum;
  return sum;
}

mint subtreeDP(int node, int parent, vector<vector<mint>>* dp, const vector<vector<int>>& edges) {
  mint mul = factorial[subtree_size[node] - 1];
  REP(i, edges[node].size()) {
    int child = edges[node][i];
    if (child == parent) {
      continue;
    }
    mint sub = subtreeDP(child, node, dp, edges) / factorial[subtree_size[child]];
    (*dp)[node][i] = sub;
    // cout << node << " " << sub.value() << endl;
    mul *= sub;
  }
  // cout << "subtreeDP:" << node << " " << mul.value() << endl;
  return mul;
}

mint ans[kMax];

void treeDP(int node, int parent, mint parent_sub_answer, vector<vector<mint>>* dp, const vector<vector<int>>& edges) {
  // cout << "treeDP:" << node << " " << parent_sub_answer.value() << endl;

  if (parent != -1) {
    REP(i, edges[node].size()) {
      if (edges[node][i] == parent) {
        (*dp)[node][i] = parent_sub_answer;
      }
    }
  }
  int num_edges = edges[node].size();
  vector<mint> dp_lower(num_edges), dp_higher(num_edges);
  mint sum = 0;
  REP(i, edges[node].size()) {
    if (i == 0) {
      dp_lower[i] = 1;
      continue;
    }
    dp_lower[i] = dp_lower[i - 1] * (*dp)[node][i - 1];
  }
  // cout << "dpsize:" << (*dp)[node].size() << endl;
  // cout << (*dp)[node].back().value() << endl;
  ans[node] = dp_lower.back() * (*dp)[node].back() * factorial[N - 1];
  for (int i = edges[node].size() - 1; i >= 0; --i) {
    if (i == edges[node].size() - 1) {
      dp_higher[i] = 1;
      continue;
    }
    dp_higher[i] = dp_higher[i + 1] * (*dp)[node][i + 1];
  }
  for (int i = 0; i < edges[node].size(); ++i) {
    int child = edges[node][i];
    if (child == parent) {
      continue;
    }
    // cout << "reverse:" << (N - subtree_size[child] - 1) << endl;
    treeDP(child, node, dp_lower[i] * dp_higher[i] * factorial[N - subtree_size[child] - 1] / factorial[N - subtree_size[child]], dp, edges);
  }
}

void init() {
  factorial[0] = 1;
  for (int i = 1; i < kMax; ++i) {
    factorial[i] = factorial[i - 1] * i;
  }
}

int main() {
  init();

  cin >> N;

  vector<vector<int>> edges(N);
  REP(i, N - 1) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }

  vector<vector<mint>> dp(N);
  REP(i, N) dp[i].resize(edges[i].size());

  subtreeSize(0, -1, edges);
  // REP(i, N) cout << "subtree_size:" << i << " "<< subtree_size[i] << endl;

  subtreeDP(0, -1, &dp, edges);
  treeDP(0, -1, -1, &dp, edges);

  REP(i, N) cout << ans[i].value() << endl;
}


Measured memory_bytes: 31476