"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(a){return a?cin[cid++]:+cin[cid++];}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var mod = 1e9+7;
function mul(){for(var a=arguments,r=a[0],i=a.length;--i;)r=((r>>16)*a[i]%mod*65536+(r&65535)*a[i])%mod;return r;}
var fac=[],finv=[],invs=[],pow2=[];
function fset(n){
  fac.length=n+1,fac[0]=fac[1]=1;
  for(var i=2;i<=n;)fac[i]=mul(fac[i-1],i++);
  finv.length=n+1,finv[0]=finv[1]=1,finv[n]=inv(fac[n]);
  for(i=n;2<i;)finv[i-1]=mul(finv[i],i--);
  //invs.length=n+1,invs[0]=invs[1]=1;
  //for(i=2;i<=n;)invs[i]=mul(fac[i-1],finv[i++]);
  //pow2.length=n+1,pow2[0]=1;
  //for(i=1;i<=n;i++)pow2[i]=pow2[i-1]*2%mod;
}
function inv(b){for(var a=mod,u=0,v=1,t;b;v=t)t=a/b|0,a-=t*b,u-=t*v,t=a,a=b,b=t,t=u,u=v;u%=mod;return u<0?u+mod:u;}
function pow(a,n){for(var r=1;n;a=mul(a,a),n>>=1)if(n&1)r=mul(a,r);return r;}
function ncr(n,r){return mul(fac[n],finv[r],finv[n-r]);}
function npr(n,r){return mul(fac[n],finv[r]);}
function mput(n){return (n%mod+mod)%mod;}

var n,g,cp,pp,ans;

//var myOut = main();
//if(myOut !== undefined)console.log(myOut);

function main(){
  n = next();
  g = xArray("[]",n);
  cp = Array(n);
  pp = Array(n);
  ans = Array(n);
  fset(2*n);
  for(var i = 1; i < n; i++){
    var a = next()-1, b = next()-1;
    g[a].push(b);
    g[b].push(a);
  }
  dfs(0,-1);
  dfsr(0,-1);
  return ans.join("\n");
}

function dfs(v,p){
  var cnow = [0,1];
  for(var i = 0; i < g[v].length; i++){
    if(g[v][i] === p)continue;
    var t = dfs(g[v][i],v);
    cnow[1] = mul(cnow[1],t[1],ncr(cnow[0]+t[0],t[0]));
    cnow[0] += t[0];
  }
  cnow[0]++;
  return cp[v] = cnow;
}
function dfsr(v,p){
  if(p === -1){
    ans[v] = cp[v][1];
    for(var i = 0; i < g[v].length; i++){
      if(g[v][i] === p)continue;
      dfsr(g[v][i],v);
    }
    return;
  }
  var t = ans[p];
  t = mul(t,inv(mul(cp[v][1],ncr(n-1,cp[v][0]))));
  t = mul(t,cp[v][1],ncr(n-1,cp[v][0]-1));
  ans[v] = t;
  for(var i = 0; i < g[v].length; i++){
    if(g[v][i] === p)continue;
    dfsr(g[v][i],v);
  }
}

if (process.argv.length <= 2) require("child_process").fork("Main.js", ["1"], { execArgv: ["--stack-size=240000"] });
else {
  var myOut = main();
  if(myOut !== undefined)console.log(myOut);
}