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

using ll = long long;
using ull = unsigned long long;
#define repi(n) for (long long i = 0; i < (n); ++i)
#define repj(n) for (long long j = 0; j < (n); ++j)
#define repk(n) for (long long k = 0; k < (n); ++k)
#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(itr) for (auto&& v : (itr))
#define updatemax(t, v) (t = std::max(t, (v)))
#define updatemin(t, v) (t = std::min(t, (v)))

#include <vector>

template <typename T, typename Merge, typename Post, typename Pre>
struct _Rerooting {
  const std::vector<std::vector<int>>& graph;
  Merge merge;
  T mergeIdentity;
  Post post;
  Pre pre;
  int n;
  std::vector<int> adjucentsLen;
  std::vector<std::vector<T>> dp;
  std::vector<T> result;

  _Rerooting(const std::vector<std::vector<int>>& graph, Merge merge, T mergeIdentity, Post post, Pre pre)
      : graph(graph), merge(merge), mergeIdentity(mergeIdentity), post(post), pre(pre), n(graph.size()) {
    adjucentsLen.resize(n);
    dp.resize(n);
    result.resize(n);
    for (int i = 0; i < n; i++) {
      adjucentsLen[i] = graph[i].size();
      dp[i].resize(adjucentsLen[i]);
    }
  }

  T dfs1(int parent, int current) {
    T result = mergeIdentity;
    for (int i = 0; i < adjucentsLen[current]; ++i) {
      int child = graph[current][i];
      if (child == parent) continue;
      dp[current][i] = dfs1(current, child);
      result = merge(result, pre(dp[current][i], child));
    }
    return post(result, current);
  }

  void dfs2(int parent, int current, T upstreamValue) {
    int m = adjucentsLen[current];

    for (int i = 0; i < m; i++) {
      if (graph[current][i] == parent) {
        dp[current][i] = upstreamValue;
        break;
      }
    }

    std::vector<T> pS(m), pL(m + 1), pR(m + 1);
    for (int i = 0; i < m; ++i) pS[i] = pre(dp[current][i], graph[current][i]);
    pL[0] = mergeIdentity;
    for (int i = 0; i < m; ++i) pL[i + 1] = merge(pL[i], pS[i]);
    pR[m] = mergeIdentity;
    for (int i = m; i > 1; --i) pR[i - 1] = merge(pR[i], pS[i - 1]);
    pR[0] = pL[m];
    result[current] = post(pL[m], current);

    for (int i = 0; i < m; ++i) {
      int child = graph[current][i];
      if (child == parent) continue;
      T value = merge(pL[i], pR[i + 1]);
      dfs2(current, child, post(value, current));
    }
  }

  std::vector<T> calc() {
    dfs1(-1, 0);
    dfs2(-1, 0, mergeIdentity);
    return result;
  }
};
template <typename T, typename Merge, typename Post, typename Pre>
std::vector<T> rerooting(const std::vector<std::vector<int>>& graph, Merge merge, T mergeIdentity, Post post, Pre pre) {
  return _Rerooting(graph, merge, mergeIdentity, post, pre).calc();
}
template <typename T, typename Merge, typename Post>
std::vector<T> rerooting(const std::vector<std::vector<int>>& graph, Merge merge, T mergeIdentity, Post post) {
  return rerooting(graph, merge, mergeIdentity, post, [](const T& a, const int i) { return a; });
}
template <typename T, typename Merge>
std::vector<T> rerooting(const std::vector<std::vector<int>>& graph, Merge merge, T mergeIdentity) {
  return rerooting(graph, merge, mergeIdentity, [](const T& a, const int i) { return a; });
}

#include <boost/operators.hpp>

class modint : private boost::operators<modint>, private boost::equivalent<modint> {
  modint(const long long x, const bool y)
      : x(x) {}

 public:
  static long long M;
  long long x;
  modint(const long long x = 0)
      : x((x % M + M) % M) {}
  modint operator-() const { return modint(x ? M - x : 0, true); }
  modint& operator+=(const modint& b) { return ((x += b.x) >= M ? x -= M : 0), *this; }
  modint& operator++() { return (++x >= M ? x -= M : 0), *this; }
  modint& operator-=(const modint& b) { return ((x -= b.x) < 0 ? x += M : 0), *this; }
  modint& operator--() { return (--x < 0 ? x += M : 0), *this; }
  modint& operator*=(const modint& b) { return x = x * b.x % M, *this; }
  modint& operator/=(const modint& b) { return *this *= b.pow(-1); }
  modint pow(long long b) const {
    long long r = 1, a = x;
    b = (b % (M - 1) + (M - 1)) % (M - 1);
    while (b) {
      if (b & 1) r = r * a % M;
      b = b >> 1;
      a = a * a % M;
    }
    return modint(r, true);
  }
  friend bool operator<(const modint& a, const modint& b) { return a.x < b.x; }
  friend std::istream& operator>>(std::istream& s, modint& a) { return s >> a.x, a = a.x, s; }
  friend std::ostream& operator<<(std::ostream& s, const modint& a) { return s << a.x; }
};
long long modint::M = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  vector<vector<int>> g(n);
  repi(n - 1) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<modint> fact(n + 100);
  fact[0] = modint(1);
  for (int i = 1; i < n + 100; i++) fact[i] = i * fact[i - 1];
  auto re = rerooting<pair<modint, int>>(
      g,
      [&](const pair<modint, int>& a, const pair<modint, int>& b) { return pair<modint, int>(a.first * b.first * fact[a.second + b.second] / fact[a.second] / fact[b.second], a.second + b.second); },
      pair<modint, int>(1, 0),
      [](const pair<modint, int>& a, int i) { return pair<modint, int>(a.first, a.second + 1); });
  itr(re) cout << v.first << endl;
}


Measured memory_bytes: 43868