#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }

struct ModInt{
    static const LL MOD = 1e+9 + 7;
    LL v;
    ModInt():v(0){}
    ModInt(LL op):v(op){}
    ModInt operator+(ModInt op) const{ return (v + op) % MOD; }
    ModInt operator-(ModInt op) const{ return (v - op + MOD) % MOD; }
    ModInt operator*(ModInt op) const{ return (v * op) % MOD; }
    ModInt operator/(ModInt op) const{ return (v * op.inverse()) % MOD; }
    ModInt operator%(LL op) = delete;
    ModInt operator+=(ModInt op){ return v = (v + op) % MOD; }
    ModInt operator-=(ModInt op){ return v = (v - op + MOD) % MOD; }
    ModInt operator*=(ModInt op){ return v = (v * op) % MOD; }
    ModInt operator/=(ModInt op){ return v = (v * op.inverse()) % MOD; }
    ModInt operator-() const{ return MOD - v; }
    bool operator==(ModInt op) const{ return v == op.v; }
    bool operator!=(ModInt op) const{ return v != op.v; }
    ModInt inverse() const{ return pow(MOD-2); }
    ModInt pow(LL n) const{
        if(n < 0) return pow(MOD-1 + n);
        if(n == 0) return 1;
        ModInt res = pow(n/2);
        return res * res * ((n&1)?ModInt(v): ModInt(1));
    }
    LL get() const{ return v; }
private:
    operator LL() const{ return v; }
};
istream& operator>>(istream& st, ModInt& m){ st>>m.v; return st; }
ostream& operator<<(ostream& st, const ModInt& m){ st<<m.v; return st; }


vector<ModInt> f;

vector<ModInt> factorial(LL n){
    vector<ModInt> res(n, 1);
    for(LL i = 2; i < n; ++i) res[i] = res[i-1] * ModInt(i);
    return res;
}

ModInt permutation(LL n, LL m, vector<ModInt>& factorial){
    if(m < 0 || n < m) return 0;
    if(m == 0) return 1;
    return factorial.at(n) / factorial.at(n-m);
}

ModInt combination(LL n, LL m, vector<ModInt>& factorial){
    if(m < 0 || n < m) return 0;
    if(m == 0) return 1;
    return factorial.at(n) / factorial.at(n-m) / factorial.at(m);
}


LL dfsCount(LL cur, LL parent, vector<vector<LL>>& edge, vector<LL>& count){
    count[cur] += 1;
    for(LL next: edge[cur]){
        if(next == parent) continue;
        count[cur] += dfsCount(next, cur, edge, count);
    }
    return count[cur];
}

ModInt dfsCount2(LL cur, LL parent, vector<vector<LL>>& edge, vector<LL>& count, vector<ModInt>& count2){
    count2[cur] = f[count[cur]-1];
    for(LL next: edge[cur]){
        if(next == parent) continue;
        count2[cur] /= f[count[next]];
        count2[cur] *= dfsCount2(next, cur, edge, count, count2);
    }
    return count2[cur];
}

void dfsAnswer(LL cur, LL parent, ModInt v, vector<vector<LL>>& edge, vector<LL>& count, vector<ModInt>& count2, vector<ModInt>& ans){
    LL n = edge.size();

    ModInt v2 = v / f[n-count[cur]];
    for(LL next: edge[cur]){
        if(next == parent) continue;
        v2 /= f[count[next]];
        v2 *= count2[next];
    }

    //cerr << "cur=" << cur << ", v=" << v << endl;
    ans[cur] = f[n-1];
    ans[cur] /= f[n-count[cur]];
    ans[cur] *= v;
    for(LL next: edge[cur]){
        if(next == parent) continue;
        ans[cur] /= f[count[next]];
        ans[cur] *= count2[next];
        dfsAnswer(next, cur, v2 * f[n-1-count[next]] * f[count[next]] / count2[next], edge, count, count2, ans);
    }
}

int main(){
    LL n;
    cin >> n;
    f = factorial(n+1);
    vector<vector<LL>> edge(n);
    for(LL i = 0; i < n-1; ++i){
        LL a, b;
        cin >> a >> b;
        --a; --b;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    vector<LL> count(n);
    dfsCount(0, -1, edge, count);
    //cerr << count << endl;

    vector<ModInt> count2(n);
    dfsCount2(0, -1, edge, count, count2);
    //cerr << count2 << endl;

    vector<ModInt> ans(n);
    dfsAnswer(0, -1, 1, edge, count, count2, ans);

    for(ModInt v: ans){
        cout << v << endl;
    }
    return 0;
}



Measured memory_bytes: 20976