/*
 *      ┌─┐       ┌─┐ + +
 *   ┌──┘ ┴───────┘ ┴──┐++
 *   │                 │
 *   │       ───       │++ + + +
 *   ███████───███████ │+
 *   │                 │+
 *   │       ─┴─       │
 *   │                 │
 *   └───┐         ┌───┘
 *       │         │
 *       │         │   + +
 *       │         │       Code is far away from bug with the animal protecting
 *       │         └──────────────┐
 *       │                        │
 *       │                        ├─┐
 *       │                        ┌─┘
 *       │                        │
 *       └─┐  ┐  ┌───────┬──┐  ┌──┘  + + + +
 *         │ ─┤ ─┤       │ ─┤ ─┤
 *         └──┴──┘       └──┴──┘  + + + +
 *                神兽保佑
 *               代码无BUG!
 */

#include<bits/stdc++.h>
using namespace std;
class IN{
public:
    template<typename T>
    IN& operator >>(T &x){read(x);return *this;}
    IN& operator >>(double &x){scanf("%lf",&x);return *this;}
    IN& operator >>(char *s){scanf("%s",s);return *this;}
    IN& operator >>(char &c){c=getchar();return *this;}
private:
    template<typename T>
    void read(T &x){
        T f=1;int c=getchar();x=0;
        while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
        while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();
        x*=f;
    }
}in;
class NL{}nl;
class BK{}bk;
class OUT{
public:
    template<typename T>
    OUT& operator <<(T x){write(x);return *this;}
    OUT& operator <<(const char *s){printf("%s",s);return *this;}
    OUT& operator <<(char c){putchar(c);return *this;}
    OUT& operator <<(BK x){putchar(' ');return *this;}
    OUT& operator <<(NL x){putchar('\n');return *this;}
private:
    template<typename T>
    void write(T x){
        if(x<0)putchar('-'),x=-x;
        if(x>=10)write(x/10);
        putchar(x%10+48);
    }
}out;

#define pb(x) push_back(x)
#define fi first
#define se second
#define rep(i,a,n) for(int i=a;i<=n;++i)
#define per(i,n,a) for(int i=n;i>=a;--i)
#define mem(a,x) memset(a,x,sizeof(a))
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

struct Comb{
    const ll p=1e9+7;
    void init(int n){
        fac.resize(n+1);
        fac_inv.resize(n+1);
        inv.resize(n+1);
        fac[0]=fac[1]=fac_inv[0]=fac_inv[1]=inv[1]=1;
        for(int i=2;i<=n;++i){
            inv[i]=(p-p/i)*inv[p%i]%p;
            fac[i]=i*fac[i-1]%p;
            fac_inv[i]=fac_inv[i-1]*inv[i]%p;
        }
    }
    ll cal(int n,int m){
        return fac[n]*fac_inv[m]%p*fac_inv[n-m]%p;
    }
    vector<ll> fac,fac_inv,inv;
}C;

const ll p=1e9+7;
const int N=2e5+10;;
const int M=2e5+10;
int head[N],ver[2*M],nex[2*M],tot=1;
inline void add(int x,int y) {ver[++tot]=y,nex[tot]=head[x],head[x]=tot;}

ll ans[N],sz[N],cnt[N];

void dfs1(int x,int fa){
    sz[x]=1;
    for(int i=head[x];i;i=nex[i]){
        int y=ver[i];
        if(y==fa)continue;
        dfs1(y,x);
        sz[x]+=sz[y];
    }
    cnt[x]=C.fac[sz[x]-1];
    for(int i=head[x];i;i=nex[i]){
        int y=ver[i];
        if(y==fa)continue;
        cnt[x]=cnt[x]*C.fac_inv[sz[y]]%p;
        cnt[x]=cnt[x]*cnt[y]%p;
    }
}
int n;
ll inv(ll a,ll p){if(a==1)return 1;return (p-p/a)*inv(p%a,p)%p;}//p为素数,a<p
void dfs2(int x,int fa,ll s,ll c){
    ll a=cnt[x]*C.fac_inv[sz[x]-1]%p;
    a=C.fac[n-1]*a%p*C.fac_inv[s]%p*c%p;
    ans[x]=a;
    for(int i=head[x];i;i=nex[i]){
        int y=ver[i];
        if(y==fa)continue;
        ll tmp=a*C.fac_inv[n-1]%p*C.fac[n-sz[y]-1]%p*C.fac[sz[y]]%p*inv(cnt[y],p)%p;
        dfs2(y,x,n-sz[y],tmp);
    }
}

int main(){
    C.init(N);
    in>>n;
    rep(i,1,n-1){
        int x,y;
        in>>x>>y;
        add(x,y);add(y,x);
    }
    dfs1(1,0);
    dfs2(1,0,0,1);
    //out<<cnt[1];
    rep(i,1,n)out<<ans[i]<<nl;
    return 0;
}


Measured memory_bytes: 15488