#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define sb __builtin_popcount
#define MOD (ll)1000000007
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
using namespace std;

vector<ll> adj[200001];
ll fac[200001];
ll dp1[200001];
ll dp2[200001];
ll sz[200001];
ll n;

ll power(ll a, ll b, ll p)
{
     ll res = 1;
     while (b > 0)
     {
          if (b & 1ll)
          {
               res *= a;
               res %= p;
          }
          a *= a;
          a %= p;
          b = (b >> 1ll);
     }
     return res % p;
}

ll dfs(ll child, ll parent)
{
     if (adj[child].size() == 1 && adj[child][0] == parent)
     {
          dp1[child] = 1;
          return sz[child] = 1;
     }
     ll size = 1;
     ll den = 1;
     ll num = 1;
     for (auto i : adj[child])
     {
          if (i != parent)
          {
               ll sc = dfs(i, child);
               den *= fac[sc];
               num *= dp1[i];
               den %= MOD;
               num %= MOD;
               size += sc;
          }
     }
     num *= fac[(size - 1ll)];
     num %= MOD;
     dp1[child] = (num * power(den, MOD - 2ll, MOD)) % MOD;
     return sz[child] = size;
}

ll dfs2(ll child, ll parent, ll data)
{
     if (parent == -1)
     {
          dp2[child] = dp1[child];
          for (auto i : adj[child])
          {
               if (i == parent)
                    continue;
               ll nik = power(dp1[i], MOD - 2ll, MOD);
               nik *= fac[sz[i]];
               nik %= MOD;
               nik *= dp2[child];
               nik %= MOD;
               nik *= power(fac[n - 1], MOD - 2ll, MOD);
               nik %= MOD;
               nik *= fac[n - sz[i] - 1];
               nik %= MOD;
               nik *= power(fac[n - sz[i]], MOD - 2ll, MOD);
               nik %= MOD;
               dfs2(i, child, nik);
          }
     }
     else
     {
          dp2[child] = (dp1[child] * data) % MOD;
          dp2[child] *= power(fac[sz[child] - 1], MOD - 2ll, MOD);
          dp2[child] %= MOD;
          dp2[child] *= fac[(n - 1ll)];
          dp2[child] %= MOD;
          for (auto i : adj[child])
          {
               if (i == parent)
                    continue;
               ll nik = power(dp1[i], MOD - 2ll, MOD);
               nik *= fac[sz[i]];
               nik %= MOD;
               nik *= dp2[child];
               nik %= MOD;
               nik *= power(fac[n - 1], MOD - 2ll, MOD);
               nik %= MOD;
               nik *= fac[n - sz[i] - 1];
               nik %= MOD;
               nik *= power(fac[n - sz[i]], MOD - 2ll, MOD);
               nik %= MOD;
               dfs2(i, child, nik);
          }
     }
     return 0;
}

int main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
     fac[0] = 1;
     for (ll i = 1; i <= 200000; i++)
     {
          fac[i] = (i * fac[i - 1]) % MOD;
     }
     cin >> n;
     for (ll i = 0; i < n - 1; i++)
     {
          ll a, b;
          cin >> a >> b;
          adj[a].push_back(b);
          adj[b].push_back(a);
     }
     dfs(1, -1);
     dfs2(1, -1, 0);
     for (ll i = 1; i <= n; i++)
     {
          cout << dp2[i] << endl;
     }
}


Measured memory_bytes: 20976