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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//end

template<unsigned mod=1000000007>struct mint {
   unsigned val;
   static unsigned get_mod(){return mod;}
   unsigned inv() const{
      int tmp,a=val,b=mod,x=1,y=0;
      while(b)tmp=a/b,a-=tmp*b,swap(a,b),x-=tmp*y,swap(x,y);
      if(x<0)x+=mod; return x;
   }
   mint():val(0){}
   mint(ll x):val(x>=0?x%mod:mod+(x%mod)){}
   mint pow(ll t){mint res=1,b=*this; while(t){if(t&1)res*=b;b*=b;t>>=1;}return res;}
   mint& operator+=(const mint& x){if((val+=x.val)>=mod)val-=mod;return *this;}
   mint& operator-=(const mint& x){if((val+=mod-x.val)>=mod)val-=mod; return *this;}
   mint& operator*=(const mint& x){val=ll(val)*x.val%mod; return *this;}
   mint& operator/=(const mint& x){val=ll(val)*x.inv()%mod; return *this;}
   mint operator+(const mint& x)const{return mint(*this)+=x;}
   mint operator-(const mint& x)const{return mint(*this)-=x;}
   mint operator*(const mint& x)const{return mint(*this)*=x;}
   mint operator/(const mint& x)const{return mint(*this)/=x;}
   bool operator==(const mint& x)const{return val==x.val;}
   bool operator!=(const mint& x)const{return val!=x.val;}
};
template<unsigned mod=1000000007>struct factorial {
   using Mint=mint<mod>;
   vector<Mint> Fact,Finv,Inv;
public:
   factorial(int maxx){
      Fact.resize(maxx+1),Finv.resize(maxx+1); Inv.resize(maxx+1);
      Fact[0]=Inv[1]=Mint(1); rep(i,0,maxx)Fact[i+1]=Fact[i]*(i+1);
      Finv[maxx]=Mint(1)/Fact[maxx]; rrep(i,maxx,0)Finv[i-1]=Finv[i]*i;
      rep(i,2,maxx+1)Inv[i]=Inv[mod%i]*(mod-mod/i);
   }
   Mint fact(int n,bool inv=0){if(inv)return Finv[n];else return Fact[n];}
   Mint inv(int n){return Inv[n];}
   Mint nPr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[n-r];}
   Mint nCr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[r]*Finv[n-r];}
}; using Mint=mint<>; using Factorial=factorial<>;

Factorial fact(201000);

int n;
vector<int> g[201000];
int cnt[201000]={};
Mint dp[201000],res[201000];
void dfs1(int v,int p){
   dp[v]=1; cnt[v]=1;
   for(int nxt:g[v])if(nxt!=p){
      dfs1(nxt,v); cnt[v]+=cnt[nxt];
      dp[v]*=dp[nxt]*fact.fact(cnt[nxt],1);
   }dp[v]*=fact.fact(cnt[v]-1);
}
void dfs2(int v,int p,Mint c){
   res[v]=dp[v]*c*fact.nCr(n-1,cnt[v]-1);
   vector<Mint> dps;
   for(int nxt:g[v])if(nxt!=p)dps.push_back(dp[nxt]*fact.fact(cnt[nxt],1));
   dps.push_back(c*fact.fact(n-cnt[v],1));
   vector<Mint> lb(dps.size()+1,1),rb(dps.size()+1,1);
   rep(i,0,dps.size())lb[i+1]=lb[i]*dps[i];
   rrep(i,dps.size()-1,-1)rb[i]=rb[i+1]*dps[i];
   int idx=0;
   for(int nxt:g[v])if(nxt!=p){
      dfs2(nxt,v,lb[idx]*rb[idx+1]*fact.fact(n-cnt[nxt]-1));
      idx++;
   }
}

int main(){
   cin>>n;
   rep(_,0,n-1){
      int u,v; cin>>u>>v; u--; v--;
      g[u].push_back(v); g[v].push_back(u);
   }
   dfs1(0,-1); dfs2(0,-1,1);
   rep(i,0,n)cout<<res[i].val<<endl;
   return 0;
}

Measured memory_bytes: 23936