#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

constexpr int MOD = 1000000007;

// + - * / ^
int mod(int a)
{
    int res = a % MOD;
    if(res < 0) {
        return res + MOD;
    }
    return res;
}
int mul_mod(int a, int b)
{
    ll res = ((ll)a * (ll)b) % MOD;
    return mod((int)res);
}
int pow_mod(int a, int b)
{
    ll res = 1;
    while (b > 0) {
        if(b & 1) {
            res = res * (ll)a % (ll)MOD;
        }
        a = mul_mod(a, a);
        b >>= 1;
    }
    return (int)res;
}
int inv_mod(int a)
{
    return pow_mod(a, MOD - 2);
}
int div_mod(int a, int b)
{
    return mul_mod(a, inv_mod(b));
}

// ! C
constexpr int FAC_MAX = 3000001;
ll fac[FAC_MAX], finv[FAC_MAX], inv[FAC_MAX];
void com_init()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < FAC_MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll com_mod(int a, int b){
    if (a < b) return 0;
    if (a < 0 || b < 0) return 0;
    return fac[a] * (finv[b] * finv[a - b] % MOD) % MOD;
}

class UnionFind {
  vector<ll> par, h;
public:
  UnionFind(ll size) : par(size, 0), h(size, 0) {
    for (int i = 0; i < size; ++i) {
      par[i] = i;
    }
  }
  void unite(ll u, ll v) {
    u = root(u), v = root(v);
    if (u == v) return;
    if (h[u] < h[v]) {
      par[u] = v;
    }
    else {
      par[v] = u;
    }
    if (h[u] == h[v]) ++h[u];
  }
  bool isUnited(ll u, ll v) {
    return root(u) == root(v);
  }
  ll root(ll v) {
    if (par[v] == v) return v;
    return par[v] = root(par[v]);
  }
};

template<class Calc>
class EdgeDpOnForest {
public:
  using T = typename Calc::type;
  struct Edge {
    ll to, rev;
    T value;
  };
private:
  ll n;
  void dfs1(ll v, ll pv) {
    ll idx = -1;
    vector<T> values;
    for (int i = 0; i < G[v].size(); ++i) {
      const Edge& e = G[v][i];
      if (e.to == pv) {
        idx = i;
        continue;
      }
      dfs1(e.to, v);
      values.push_back(e.value);
    }
    // 根以外では親から入る辺の値を更新
    if (idx >= 0) {
      const Edge& e = G[v][idx];
      G[e.to][e.rev].value = Calc::merge(values);
    }
  }
  void dfs2(ll v, ll pv) {
    vector<T> values;
    for (auto&& e : G[v]) values.push_back(e.value);
    values = Calc::evaluate(values);
    for (int i = 0; i < G[v].size(); ++i) {
      const Edge& e = G[v][i];
      if (e.to == pv) continue;
      G[e.to][e.rev].value = values[i];
      dfs2(e.to, v);
    }
  }
public:
  UnionFind uf;
  vector<vector<Edge>> G;
  EdgeDpOnForest(ll n) : n(n), uf(n), G(n) {}
  // 辺を追加する
  void add(ll u, ll v) {
    assert(!uf.isUnited(u, v));
    G[u].push_back({v, ll(G[v].size())});
    G[v].push_back({u, ll(G[u].size())-1});
    uf.unite(u, v);
  }
  // 各有向辺の値 G[v][i].value を計算する
  void dp() {
    vector<bool> used(n, false);
    for (int i = 0; i < n; ++i) {
      if (used[uf.root(i)]) continue;
      dfs1(i, -1);
      used[uf.root(i)] = true;
    }
    used.assign(n, false);
    for (int i = 0; i < n; ++i) {
      if (used[uf.root(i)]) continue;
      dfs2(i, -1);
      used[uf.root(i)] = true;
    }
  }
  size_t size() const {
    return G.size();
  }
};

// これらを実装してください
struct Merger {
    using type = P;
    // その頂点から出ていく値から入ってくる値を計算する
    static vector<type> evaluate(const vector<type>& value) {
        const ll n = value.size();
        vector<type> L(n + 1, {0, 1}), R(n + 1, {0, 1});
        rep (i, n) {
            L[i + 1] = {
                L[i].first + value[i].first, 
                div_mod(mul_mod(L[i].second, value[i].second), fac[value[i].first])
            };
        }
        reprev (i, n) {
            R[i] = {
                R[i + 1].first + value[i].first, 
                div_mod(mul_mod(R[i + 1].second, value[i].second), fac[value[i].first])
            };
        }
        vector<type> res(n);
        rep (i, n) {
            res[i] = {
                L[i].first + R[i + 1].first + 1,
                mul_mod(fac[L[i].first + R[i + 1].first], mul_mod(L[i].second, R[i + 1].second))
            };
        }
        return res;
    }
    // (辺数-1)個の出ていく値から1個の入ってくる値を計算する
    static type merge(const vector<type>& value) {
        int sum = 0;
        for (auto &x : value) sum += x.first;
        int res = fac[sum];
        for (auto &x : value) res = mul_mod(res, div_mod(x.second, fac[x.first]));
        return {sum + 1, res};
    }
};

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    com_init();
    int n; cin >> n;
    EdgeDpOnForest<Merger> dp(n);
    rep (i, n - 1) {
        int a, b; cin >> a >> b; a--; b--;
        dp.add(a, b);
    }
    dp.dp();
    rep (i, n) {
        ll sum = 0;
        for (auto &x : dp.G[i]) sum += x.value.first;
        ll ans = 1;
        for (auto &x : dp.G[i]) ans = mul_mod(ans, div_mod(x.value.second, fac[x.value.first]));
        cout << mul_mod(fac[sum], ans) << "\n";
    }
    return 0;
}

Measured memory_bytes: 96044