#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

template<typename T, long long MOD_VALUE>
class ModInt {
    static constexpr long long MOD = MOD_VALUE;
    private:
        T value_;
    public:
        ModInt() {}
        ModInt(const T& value) {if (value >= 0) {value_ = value % MOD;} else {T k = (MOD - 1 - value) / MOD; value_ = (value + k * MOD) % MOD;}}
        ModInt& operator+=(const ModInt& x)  {value_ += x.value_; if (value_ >= MOD) value_ -= MOD; return *this;}
        friend ModInt& operator+=(const T& x, const ModInt& y) {ModInt res(x); res.value_ += x.value_; if (res.value_ >= MOD) res.value_ -= MOD; return res;}
        ModInt& operator-=(const ModInt& x) {if (value_ < x.value_) value_ += MOD; value_ -= x.value_; return *this;}
        friend ModInt& operator-=(const T& x, const ModInt& y) {ModInt res(x); if (res.value_ < y.value_) res.value_ += MOD; res.value_ -= y.value_; return res;}
        ModInt& operator*=(const ModInt& x) {value_ = (value_ * x.value_) % MOD; return *this;}
        friend ModInt& operator*=(const T& x, const ModInt& y) {ModInt res(x); res.value_ = (res.value_ * y.value_) % MOD; return res;}
        const ModInt operator+(const ModInt& x) const {return ModInt(*this) += x;}
        friend const ModInt operator+(const T& x, const ModInt& y) {return ModInt(x) += y;}
        const ModInt operator-(const ModInt& x) const {return ModInt(*this) -= x;}
        friend const ModInt operator-(const T& x, const ModInt& y) {return ModInt(x) -= y;}
        const ModInt operator*(const ModInt& x) const {return ModInt(*this) *= x;}
        friend const ModInt operator*(const T& x, const ModInt& y) {return ModInt(x) *= y;}
        static ModInt modpow(ModInt x, long long y) {ModInt z = 1; while (y > 0) {if (y & 1) {z *= x;}x *= x; y /= 2;} return z;}
        ModInt& operator/=(const ModInt& x) {return *this *= modpow(x, MOD - 2);}
        const ModInt operator/(const ModInt& x) const {return ModInt(*this) /= x;}
        friend const ModInt operator/(const T& x, const ModInt& y) {return ModInt(x) /= y;}
        ModInt operator++(int) {ModInt tmp(*this); value_ = (value_ + 1 == MOD ? 0 : value_ + 1); return tmp;}
        ModInt operator--(int) {ModInt tmp(*this); value_ = (value_ - 1 < 0 ? MOD - 1 : value_ - 1); return tmp;}
        friend istream& operator>>(istream& stream, ModInt& x) {stream >> x.value_; x.value_ %= MOD; return stream;}
        friend ostream& operator<<(ostream& stream, const ModInt& x) {stream << x.value_; return stream;}
};

using mint = ModInt<ll, 1000000007>;

int dfs1(const vector<vector<int>>& graph, vector<int>& size, int node, int parent) {
    int res = 1;
    for (auto& next_node : graph[node]) {
        if (next_node == parent) {
            continue;
        }
        res += dfs1(graph, size, next_node, node);
    }
    return size[node] = res;
}

mint memo(const vector<vector<int>>& graph, const vector<mint>& factorial, const vector<int>& size, vector<mint>& dp, int node, int parent) {
    mint res = factorial[size[node] - 1];
    for (auto& next_node : graph[node]) {
        if (next_node == parent) {
            continue;
        }
        res *= memo(graph, factorial, size, dp, next_node, node);
        res /= factorial[size[next_node]];
    }
    return dp[node] = res;
}

void dfs2(const vector<vector<int>>& graph, vector<int>& size, vector<mint>& dp, int node, int parent) {
    for (auto& next_node : graph[node]) {
        if (next_node == parent) {
            continue;
        }
        dp[next_node] = dp[node] * size[next_node] / (size[node] - size[next_node]);
        size[next_node] = size[node];
        dfs2(graph, size, dp, next_node, node);
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<vector<int>> graph(N);
    int a, b;
    rep(_, 0, N - 1) {
        cin >> a >> b;
        --a, --b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    vector<int> size(N);
    dfs1(graph, size, 0, -1);
    vector<mint> factorial(N + 1);
    factorial[0] = 1;
    rep(i, 0, N) {
        factorial[i + 1] = (i + 1) * factorial[i];
    }
    vector<mint> dp(N);
    memo(graph, factorial, size, dp, 0, -1);
    dfs2(graph, size, dp, 0, -1);
    rep(i, 0, N) {
        cout << dp[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 17908