#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define fout(x) cout << fixed << setprecision(10) << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

auto print = [](auto &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
};

constexpr int MAX_N = 1000000;

template <int mod = 1000000007>
struct ModInt {
  long long x;
  constexpr ModInt(long long x = 0) : x((x % mod + mod) % mod) {}
  constexpr ModInt operator-() const { return ModInt(-x); }
  constexpr ModInt inv() const { return pow(mod - 2); }
  constexpr ModInt operator+(const ModInt& m) const {
    ModInt res(*this);
    return res += m;
  }
  constexpr ModInt operator-(const ModInt& m) const {
    ModInt res(*this);
    return res -= m;
  }
  constexpr ModInt operator*(const ModInt& m) const {
    ModInt res(*this);
    return res *= m;
  }
  constexpr ModInt operator/(const ModInt& m) const {
    ModInt res(*this);
    return res /= m;
  }
  constexpr ModInt& operator+=(const ModInt& m) {
    if ((x += m.x) >= mod) x -= mod;
    return *this;
  }
  constexpr ModInt& operator-=(const ModInt& m) {
    if ((x += mod - m.x) >= mod) x -= mod;
    return *this;
  }
  constexpr ModInt& operator*=(const ModInt& m) {
    (x *= m.x) %= mod;
    return *this;
  }
  constexpr ModInt& operator/=(const ModInt& m) { return (*this) *= m.inv(); }
  constexpr ModInt pow(long long p) const {
    if (p == 0) return 1;
    ModInt m = pow(p >> 1);
    m *= m;
    if (p & 1) m *= *this;
    return m;
  }
  constexpr bool operator==(const ModInt& m) const { return x == m.x; }
  constexpr bool operator!=(const ModInt& m) const { return x != m.x; }
};

template<int T>
std::ostream& operator<<(std::ostream& os, const ModInt<T>& m) {
  os << m.x;
  return os;
};

using mint = ModInt<>;

template <int mod = 1000000007>
struct Combination {
  std::vector<long long> fac, finv, inv;
  Combination(int n) : fac(n + 1, 0), finv(n + 1, 0), inv(n + 1, 0) {
    for (int i = 0; i < n + 1; ++i) {
      bool one_or_zero = i == 0 || i == 1;
      fac[i] = one_or_zero ? 1 : fac[i - 1] * i % mod;
      inv[i] = one_or_zero ? 1 : mod - inv[mod % i] * (mod / i) % mod;
      finv[i] = one_or_zero ? 1 : finv[i - 1] * inv[i] % mod;
    }
    inv[0] = 0;
  }
  int operator()(int n, int r) {
    if (n < r || n < 0 || r < 0) return 0;
    else if (n == r || r == 0) return 1;
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod;
  }
};
Combination<> comb(MAX_N);

struct DP {
  mint dp;
  int size;
  DP(mint dp = 1, int size = 0) : dp(dp), size(size) {}
  DP& operator+=(const DP& d) {
    dp *= d.dp;
    dp *= comb(size + d.size, d.size);
    size += d.size;
    return *this;
  }
  DP operator-(const DP& d) const {
    DP ret(*this);
    ret.size -= d.size;
    ret.dp /= comb(ret.size + d.size, d.size);
    ret.dp /= d.dp;
    return ret;
  }
  DP up_process() {
    DP ret(*this);
    ret.size++;
    return ret;
  }
};

DP dp[MAX_N];

void up(VVI& to, int v, int p = -1) {
  for(int u : to[v]) {
    if(u == p) continue;
    up(to, u, v);
    dp[v] += dp[u].up_process();
  }
};

void down(VVI& to, int v, int p = -1) {
  for(int u : to[v]) {
    if(u == p) continue;
    DP d = dp[v] - dp[u].up_process();
    dp[u] += d.up_process();
    down(to, u, v);
  }
};

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  VVI to(n);
  rep(i, n - 1) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  up(to, 0);
  down(to, 0);
  rep(i, n) {
    out(dp[i].dp);
  }
  return 0;
}


Measured memory_bytes: 52980