#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
//typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
int n;
struct Nums{
    long long n;
    vector<long long> kaijo;
    void build(int N){
        n=N;
        kaijo.push_back(1);
        for(long long i=1;i<=n;i++){
            kaijo.push_back((kaijo[i-1]*i)%MOD);
        }
    }
    long myPow(long x, long n, long m){
        if(n == 0)
            return 1;
        if(n % 2 == 0)
            return myPow(x * x % m, n / 2, m);
        else
            return x * myPow(x, n - 1, m) % m;
    }
    long long modinv(long long a, long long m) {
        long long b = m, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        u %= m;
        if (u < 0) u += m;
        return u;
    }
    long long comb(long long N,long long K,long long rest){
        long long res=kaijo[N]*modinv(kaijo[K],rest)%rest;
        res*=modinv(kaijo[N-K],rest);
        res%=rest;
        return res;
    }
};
Nums lib;
struct Node{
  int no;
  int par;
  int num;
  int P;
  int Pass;
  int top;
  bool comp;
  vector<Node*> child;
  void build(int i){
    no=i;par=i;num=1;P=1;comp=false;
    Pass=0;top=1;
  }
};
void calc(Node& node){
  int num=node.child.size();
  if(node.comp){

  }
  else{
    int sum=0;
    int P=1;
    int div=1;
    node.comp=true;
    rep(i,num){
      if(node.child[i]->no==node.par)continue;
      calc(*node.child[i]);
      if(node.child[i]->comp){
        sum+=node.child[i]->num;
        P*=node.child[i]->P;
        P%=MOD;
        div*=lib.kaijo[node.child[i]->num];
        div%=MOD;
      }
    }
    node.num=sum+1;
    node.P=P*lib.kaijo[sum]%MOD;
    node.P*=lib.modinv(div,MOD);
    node.P%=MOD;
    //printf("%lld %lld\n",node.no,node.P);
  }
}
void solve(vector<int>& res,vector<Node>& node){
  queue<Node> que;
  que.push(node[1]);
  while(!que.empty()){
    Node buf=que.front();que.pop();
    int num=buf.child.size();
    int hoge=1;
    hoge*=node[buf.par].Pass;
    hoge%=MOD;
    hoge*=lib.modinv(lib.kaijo[n-1],MOD);
    hoge%=MOD;
    hoge*=lib.kaijo[n-1-buf.num];
    hoge%=MOD;
    hoge*=lib.modinv(buf.P,MOD);
    hoge%=MOD;
    hoge*=lib.kaijo[buf.num];
    hoge%=MOD;
    int Pyp=hoge;
    int Pnum=n-buf.num;
    rep(i,num){
      if(buf.child[i]->no!=buf.par){
        Pyp*=buf.child[i]->P;
        Pyp%=MOD;
        Pyp*=lib.modinv(lib.kaijo[buf.child[i]->num],MOD);
        Pyp%=MOD;
        que.push(*buf.child[i]);
      }
    }
    Pyp*=lib.kaijo[n-1];
    Pyp%=MOD;
    Pyp*=lib.modinv(lib.kaijo[Pnum],MOD);
    Pyp%=MOD;
    if(buf.no==1)continue;
    node[buf.no].Pass=Pyp;
    res[buf.no]=Pyp;
  }
}
signed main(){
  //cin.tie(nullptr);
  cin>>n;
  vector<Node> node(n+1);
  lib.build(n);
  rep(i,n+1){
    node[i].build(i);
  }
  rep(i,n-1){
    int a,b;cin>>a>>b;
    node[a].child.push_back(&node[b]);
    node[b].child.push_back(&node[a]);
  }
  queue<Node> que;
  que.push(node[1]);
  while(!que.empty()){
    Node buf=que.front();que.pop();
    int num=buf.child.size();
    if(num==1&&buf.no!=1)node[buf.no].comp=true;
    rep(i,num){
      if(buf.child[i]->no!=buf.par){
        buf.child[i]->par=buf.no;
        que.push(*buf.child[i]);
      }
    }
  }
  vector<int> res(n+1,0);
  calc(node[1]);
  node[1].Pass=node[1].P;
  //cout<<node[1].P<<"\n";
  res[1]=node[1].P;
  solve(res,node);
  rep1(i,n){
    cout<<res[i]<<"\n";
  }
  return 0;
}


Measured memory_bytes: 51256