#include <bits/stdc++.h>
using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INF = 2147483647;
const long long LINF = 1LL<<60;
const long long MOD = 1000000007; // 998244353

#define CLR(a) memset((a), 0, sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

struct mint {
    long long x;
    mint(long long x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
    	return *this;
    }
    mint& operator*=(const mint a) {
    	(x *= a.x) %= MOD;
    	return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
    	if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint a) {
    	return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

template<typename T>
struct Node{
    int id;
    T v;
    bool done = false;
    Node(int id, T v=1e9): id(id), v(v) {}
    Node() {}
};

template<typename T>
struct Edge{
    int from, to, id;
    T cost;
    Edge(int from, int to, T cost=1, int id=-1): from(from), to(to), cost(cost), id(id) {}
};

template<typename T>
struct Graph{
    int N;
    vector<vector<Edge<T>>> adj;
    vector<Node<T>> node;

    Graph(int N): N(N) {
        adj.assign(N, vector<Edge<T>>());
        node.assign(N, Node<T>());
        for(int i=0; i<N; ++i) node[i].id = i;
    }

    Graph() {}

    void add_edge(int i, int j, T cost=1, int id=-1){
        Edge<T> e(i, j, cost, id);
        adj[i].emplace_back(e);
    }

    vector<Edge<T>> get_adj(Node<T> node){
        return adj[node.id];
    }

    void assign(int n){
        N = n;
        adj.assign(N, vector<Edge<T>>());
        node.assign(N, Node<T>());
        for(int i=0; i<N; ++i) node[i].id = i;
    }

    void reset(){
        for(int i=0; i<N; ++i){
            node[i].done = false;
            node[i].v = 1e9;
        }
    }
};

template<typename T>
struct ReRooting{
    typedef function<T(T,T)> F1;
    typedef function<T(T,int)> F2;

    int N;
    F1 merge;
    F2 addNode;
    T e;
    Graph<T> G;

    vector<vector<int>> i4adj;
    vector<vector<T>> dp; // dp[i][j] := iを親, j番目の隣接ノードを根とする部分木の値
    vector<T> ret;

    ReRooting(int n, F1 f, F2 g, T identity): N(n), merge(f), addNode(g), e(identity){
        G.assign(n);
        i4adj.resize(n);
    }

    void add_edge(int i, int j, T cost=1, int id=-1){
        i4adj[i].push_back((int)G.adj[j].size());
        i4adj[j].push_back((int)G.adj[i].size());
        G.add_edge(i, j, cost, id); // G.adj[i][G.adj[i].size()] = j: iから見てk番目のノードはj
        G.add_edge(j, i, cost, id); // G.adj[j][G.adj[j].size()] = i: jから見てl番目のノードはi
    }

    void initialize(){
        dp.resize(N);
        for(int i=0; i<N; i++)
            dp[i].resize(G.adj[i].size());
        ret.resize(N);

        if(N == 1){
            ret[0] = addNode(e, 0);
            return;
        }

        vector<int> par(N), order(N); // par[i] := 0を根としたときの親 order[i] := dfsでのi番目の訪問ノード
        par[0] = -1;
        int index = 0;
        stack<int> stk; stk.push(0);
        while(!stk.empty()){
            int node = stk.top(); stk.pop();
            order[index++] = node;

            for(Edge<T>& e : G.adj[node]){
                if(e.to == par[node]) continue;
                stk.push(e.to);
                par[e.to] = node;
            }
        }

        // 0を根とする木について解を求める
        for(int i=N-1; i>=1; i--){
            int node = order[i];
            int parent = par[node];

            T result = e;
            int parIndex = -1;
            for(int j=0; j<G.adj[node].size(); j++){
                Edge<T>& e = G.adj[node][j];
                if(e.to == parent){
                    parIndex = j;
                    continue;
                }
                result = merge(result, dp[node][j]);
            }
            dp[parent][i4adj[node][parIndex]] = addNode(result, node);
        }

        // 全ての頂点について解を求める
        for(int i=0; i<N; i++){
            int node = order[i];
            T accum = e;
            vector<T> accumsFromTail(G.adj[node].size());
            accumsFromTail[accumsFromTail.size() - 1] = e;

            for (int j=accumsFromTail.size()-1; j >= 1; j--)
                    accumsFromTail[j - 1] = merge(dp[node][j], accumsFromTail[j]);

            for (int j = 0; j < accumsFromTail.size(); j++) {
                dp[G.adj[node][j].to][i4adj[node][j]] = addNode(merge(accum, accumsFromTail[j]), node);
                accum = merge(accum, dp[node][j]);
            }
            ret[node] = addNode(accum, node);
        }
    }

    T query(int node){
        return ret[node];
    }

};

vector<mint> kai;

pair<mint,ll> f(pair<mint,ll> a, pair<mint,ll> b){
    ll ase = a.second, bse = b.second;
    mint fi = a.first * b.first * kai[ase + bse] / kai[ase] / kai[bse];
    return pair<mint,ll>(fi, ase+bse);
}

pair<mint,ll> g(pair<mint,ll> a, int b){
    return pair<mint,ll>(a.first, a.second+1);
}

int main(void){
    int N; cin >> N; kai.resize(N);
    kai[0] = 1; REP(i,N-1) kai[i+1] = kai[i]*(ll)(i+1);

    ReRooting<pair<mint,ll>> rrt(N, f, g, pair<mint,ll>(mint(1),0));
    REP(i,N-1){
        int a,b; cin >> a >> b; a--; b--;
        rrt.add_edge(a,b,rrt.e);
    }

    rrt.initialize();
    REP(i,N) cout << rrt.query(i).first.x << en;
    return 0;
}

Measured memory_bytes: 66152