// Original C++ solution (slower):
#include <iostream>

#include <vector>

#include <map>

#include <unordered_map>

#include <queue>

#include <set>

#include <algorithm>

#include <string>

#include <math.h>

#include <limits.h>

#include <stack>

#include <complex>

#include <stdlib.h>

#include <stdio.h>

#include <functional>

#include <cfloat>

#include <math.h>

#include <numeric>

#include <string.h>

#include <sys/time.h>

#include <random>





#define fs first

#define sc second



using namespace std;



typedef long long ll;

typedef unsigned int uint;

typedef pair<ll, ll> P;





class modInt{

    ll value;

    static const ll mod = 1000000007;



public:

    modInt(ll x): value{x % mod}{}



    inline modInt& operator+=(modInt x){

        value = (value + x.value) % mod;

        return *this;

    }



    inline modInt& operator-=(modInt x){

        value = (value + mod - x.value) % mod;

        return *this;

    }



    inline modInt& operator*=(modInt x){

        value = (value * x.value) % mod;

        return *this;

    }





    inline modInt operator/=(modInt x){

        *this *= x.inv();

        return *this;

    }



    inline modInt pow(modInt x, int n){

        modInt res = modInt(1LL);

        while(n > 0){

            if(n & 1)   res *= x;

            x *= x;

            n >>= 1;

        }

        return res;

    }



    inline modInt inv(){

        modInt res = pow(value, mod-2);

        return res;

    }



    inline ll get(){

        return value;

    }

};



modInt operator+(modInt x, modInt y){

    return x += y;

}



modInt operator-(modInt x, modInt y){

    return x -= y;

}



modInt operator*(modInt x, modInt y){

    return x *= y;

}



modInt operator/(modInt x, modInt y){

    return x /= y;

}



ostream& operator<<(ostream& os, modInt x){

    return os << x.get();

}





class modIntCombinations{

    vector<modInt> factArray;



    void make_fact(ll x){

        for(auto i = factArray.size(); i <= x+1; i++){

            modInt y = factArray[i-1] * i;

            factArray.push_back(y);

        }

    }



public:

    modIntCombinations(){

        factArray.emplace_back(1);

    }



    modInt fact(ll x){

        if(factArray.size() < x+1){

            make_fact(x);

        }

        return factArray[x];

    }



    modInt comb(ll n, ll k){

        if(n < k){

            return modInt{0};

        }

        else{

            return fact(n) / fact(k) / fact(n - k);

        }

    }



    modInt perm(ll n, ll k){

        if(n < k){

            return modInt{0};

        }

        else{

            return fact(n) / fact(k);

        }

    }

};





class Graph{

    struct edge{

        int vertice;

        ll weight;

    };



    vector<vector<edge>> g;

    unsigned int n;



public:

    Graph(unsigned int n): n{n}{

        g.resize(n);

    }



    void add_edge(int u, int v){

        g[u].emplace_back(edge{v, 1});

    };



    void add_edge(int u, int v, ll w){

        g[u].emplace_back(edge{v, w});

    }



    vector<edge>& get_edge(int v){

        return g[v];

    }



    unsigned int get_num_vertices(){

        return n;

    }



    vector<edge>& operator[](int v){

        return get_edge(v);

    }

};



int child[201000];

vector<modInt> childRes(201000, 0LL);

vector<modInt> resList(201000, 0LL);





modInt dfs(int v, int prev, Graph& g, modIntCombinations& mic){

    modInt res = modInt{1};

    int num = 0, childSum = 0;

    for(auto u: g[v]){

        if(u.vertice == prev)   continue;

        modInt x = dfs(u.vertice, v, g, mic);

        res *= x;

        num += child[u.vertice];

        childSum += child[u.vertice];

    }

    for(auto u: g[v]){

        if(u.vertice == prev) continue;

        int childNum = child[u.vertice];

        res *= mic.comb(num, childNum);

        num -= childNum;

    }

    childSum++;

    child[v] = childSum;

    childRes[v] = res;



    return res;

}



void dfs2(int v, int prev, Graph& g, modIntCombinations& mic, int N, modInt from){

    modInt res = childRes[v];

    int remained = N - child[v];

    res *= mic.comb(N-1, remained);

    res *= from;

    resList[v] = res;



    for(auto u: g[v]){

        if(u.vertice == prev)   continue;

        dfs2(u.vertice, v, g, mic, N, res / mic.comb(N-1, child[u.vertice]) / childRes[u.vertice]);

    }

}





int main(){

    int N;

    cin >> N;

    Graph g(N);

    for(int i = 0; i < N-1; i++){

        int a, b;   cin >> a >> b;

        a--; b--;

        g.add_edge(a, b);

        g.add_edge(b, a);

    }

    modIntCombinations mic{};



    modInt res1 = dfs(0, 0, g, mic);

    resList[0] = res1;

    for(auto u: g[0]){

//        mp[0][u.vertice] = res1 / mic.comb(N-1, child[u.vertice]) / childRes[u.vertice];

        dfs2(u.vertice, 0, g, mic, N, res1 / mic.comb(N-1, child[u.vertice]) / childRes[u.vertice]);

    }



    for(int i = 0; i < N; i++){

        cout << resList[i] << endl;

    }







    return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <vector>

#include <map>

#include <unordered_map>

#include <queue>

#include <set>

#include <algorithm>

#include <string>

#include <math.h>

#include <limits.h>

#include <stack>

#include <complex>

#include <stdlib.h>

#include <stdio.h>

#include <functional>

#include <cfloat>

#include <math.h>

#include <numeric>

#include <string.h>

#include <sys/time.h>

#include <random>





#define fs first

#define sc second

#define endl "\n"



using namespace std;



typedef long long ll;

typedef unsigned int uint;

typedef pair<ll, ll> P;



class modInt{

    ll value;

    static const ll mod = 1000000007;



public:

    modInt(ll x=0): value{x % mod}{}



    inline modInt& operator+=(modInt x){

        value = (value + x.value) % mod;

        return *this;

    }



    inline modInt& operator-=(modInt x){

        value = (value + mod - x.value) % mod;

        return *this;

    }



    inline modInt& operator*=(modInt x){

        value = (value * x.value) % mod;

        return *this;

    }





    inline modInt operator/=(modInt x){

        *this *= x.inv();

        return *this;

    }



    inline modInt pow(modInt x, int n){

        modInt res = modInt(1LL);

        while(n > 0){

            if(n & 1)   res *= x;

            x *= x;

            n >>= 1;

        }

        return res;

    }



    inline modInt inv(){

        modInt res = pow(value, mod-2);

        return res;

    }



    inline ll get(){

        return value;

    }

};



modInt operator+(modInt x, modInt y){

    return x += y;

}



modInt operator-(modInt x, modInt y){

    return x -= y;

}



modInt operator*(modInt x, modInt y){

    return x *= y;

}



modInt operator/(modInt x, modInt y){

    return x /= y;

}



ostream& operator<<(ostream& os, modInt x){

    return os << x.get();

}





class modIntCombinations{

    vector<modInt> factArray;



    void make_fact(ll x){

        for(auto i = factArray.size(); i <= x+1; i++){

            modInt y = factArray[i-1] * i;

            factArray.push_back(y);

        }

    }



public:

    modIntCombinations(){

        factArray.emplace_back(1);

    }



    modInt fact(ll x){

        if(factArray.size() < x+1){

            make_fact(x);

        }

        return factArray[x];

    }



    modInt comb(ll n, ll k){

        if(n < k){

            return modInt{0};

        }

        else{

            return fact(n) / fact(k) / fact(n - k);

        }

    }



    modInt perm(ll n, ll k){

        if(n < k){

            return modInt{0};

        }

        else{

            return fact(n) / fact(k);

        }

    }

};



class Graph{

    struct edge{

        int vertice;

        ll weight;

    };



    vector<vector<edge>> g;

    unsigned int n;



public:

    Graph(unsigned int n): n{n}{

        g.resize(n);

    }



    void add_edge(int u, int v){

        g[u].emplace_back(edge{v, 1});

    };



    void add_edge(int u, int v, ll w){

        g[u].emplace_back(edge{v, w});

    }



    vector<edge>& get_edge(int v){

        return g[v];

    }



    unsigned int size(){

        return n;

    }



    vector<edge>& operator[](int v){

        return get_edge(v);

    }

};





/**

 * parentFun(merge(childFun(dp_c1), childFun(dp_c2), \ldots, childFun(dp_cm))

 * @tparam T

 */

template <typename T>

class ReRooting{

private:

    using Operate = function<T(T, T)>;  // monoid

    using OperateNode = function<T(T, int)>;



    Graph g;

    Operate merge;

    T u;                 // Operateについての単位元

    OperateNode childFun, parentFun;



    vector<vector<T>> dp;

    vector<T> res;



    T dfs1(int v, int prev){

        T res = u;

        for(int i = 0; i < g[v].size(); i++){

            auto e = g[v][i];

            if(e.vertice == prev)   continue;

            dp[v][i] = dfs1(e.vertice, v);

            res = merge(res, childFun(dp[v][i], e.vertice));

        }



        return parentFun(res, v);

    }



    void dfs2(int v, int prev, T fromP){

        int n = g[v].size();        // vからの辺を持つ頂点数

        for(int i = 0; i < n; i++){

            auto e = g[v][i];

            if(e.vertice == prev){

                dp[v][i] = fromP;

                break;

            }

        }



        vector<T> cumFromLeft(n + 1), cumFromRight(n + 1);

        cumFromLeft[0] = u; cumFromRight[n] = u;

        for(int i = 0; i < n; i++){

            cumFromLeft[i+1] = merge(cumFromLeft[i], childFun(dp[v][i], v));

        }

        for(int i = n-1; i >= 0; i--){

            cumFromRight[i] = merge(cumFromRight[i+1], childFun(dp[v][i], v));

        }



        for(int i = 0; i < n; i++){

            auto e = g[v][i];

            if(e.vertice == prev)   continue;

            T fromC = parentFun(merge(cumFromLeft[i], cumFromRight[i+1]), v);

            dfs2(e.vertice, v, fromC);

        }



        res[v] = parentFun(cumFromLeft[n], v);

    }





public:

    ReRooting(Graph& g_, Operate merge_, T u_, OperateNode childFun_, OperateNode parentFun_):

            g(g_), merge(merge_), u(u_), childFun(childFun_), parentFun(parentFun_){

        dp.resize(g.size());

        for(int i = 0; i < g.size(); i++){

            dp[i].resize(g[i].size());

        }

        res.resize(g.size());

    }



    void calc(int root = 0){

        dfs1(root, root);

        dfs2(root, root, u);

    }



    T get(int v){

        return res[v];

    }

};





int main(){

    int n;

    cin >> n;



    Graph g(n);

    for(int i = 0; i < n-1; i++){

        int x, y;   cin >> x >> y;

        x--; y--;

        g.add_edge(x, y);

        g.add_edge(y, x);

    }

    vector<modInt> distribute(n);

    vector<ll> childsNumList(n);

    modIntCombinations mic;



    typedef pair<modInt, ll> P2;

    ReRooting<P2> reroot(g, [](P2 x, P2 y){ P2 tmp =  P2(x.fs * y.fs, x.sc + y.sc); return tmp; },

                         P2(modInt{1}, 0LL),

                         [&](P2 x, int v) { P2 tmp = P2(x.fs / mic.fact(x.sc), x.sc); return tmp; },

                         [&](P2 x, int v) { P2 tmp = P2(x.fs * mic.fact(x.sc), x.sc + 1); return tmp; });



    reroot.calc(0);

    for(int i = 0; i < n; i++){

        cout << reroot.get(i).fs << endl;

    }



    return 0;

}


// Fastest known solution for this problem: