#![allow(dead_code)]

use std::io::{stdin, Read};
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};

pub fn get_factorials(n: usize) -> Vec<Mint<usize>> {
    let mut facts = vec![Mint(0); n];
    facts[0] = Mint(1);
    for i in 1..n {
        facts[i] = facts[i - 1] * (i as usize);
    }
    facts
}

pub fn get_facinvs(n: usize, facts: &Vec<Mint<usize>>) -> Vec<Mint<usize>> {
    let mut invs = vec![Mint(0); n];
    invs[n - 1] = facts[n - 1].inv();
    for i in (0..(n - 1)).rev() {
        invs[i] = invs[i + 1] * (i + 1)
    }
    invs
}

fn gcd(a: usize, b: usize) -> usize {
    match b {
        0 => a,
        _ => gcd(b, a % b),
    }
}

fn prime_factors(x: usize) -> Vec<usize> {
    let mut res = vec![];
    let mut y = x;
    let mut p = 2;
    let upper = (y as f64).sqrt() as usize;
    while y > 1 && p <= upper {
        match y % p {
            0 => {
                res.push(p);
                y /= p;
            }
            _ => {
                p += 1;
            }
        }
    }
    if y > 1 {
        res.push(y)
    }
    return res;
}

struct CombMod {
    facts: Vec<Mint<usize>>,
    invs: Vec<Mint<usize>>,
}

impl CombMod {
    fn new(n: usize) -> Self {
        let facts = get_factorials(n);
        let invs = get_facinvs(n, &facts);
        CombMod {
            facts: facts,
            invs: invs,
        }
    }
    fn get(&self, a: usize, b: usize) -> Mint<usize> {
        if a < b {
            Mint(0)
        } else {
            (self.facts[a as usize] * self.invs[b as usize]) * self.invs[(a - b) as usize]
        }
    }
}
pub const MOD: usize = 1000_000_007;

#[derive(Clone, Copy)]
pub struct Mint<T: Copy>(pub T);

impl Mint<usize> {
    pub fn pow(self, exp: usize) -> Self {
        let mut exp = exp;
        let mut v = self;
        let mut ret = Mint(1);
        while exp > 0 {
            if exp & 1 == 1 {
                ret *= v;
            }
            v *= v;
            exp >>= 1;
        }
        ret
    }
    pub fn inv(self) -> Self {
        self.pow(MOD - 2)
    }
}

impl Add<usize> for Mint<usize> {
    type Output = Self;
    fn add(self, rhs: usize) -> Self::Output {
        Mint((self.0 + rhs) % MOD)
    }
}

impl Add for Mint<usize> {
    type Output = Self;
    fn add(self, rhs: Self) -> Self::Output {
        self + rhs.0
    }
}

impl AddAssign<usize> for Mint<usize> {
    fn add_assign(&mut self, rhs: usize) {
        *self = *self + rhs;
    }
}

impl AddAssign for Mint<usize> {
    fn add_assign(&mut self, rhs: Self) {
        *self = *self + rhs;
    }
}

impl Sub<usize> for Mint<usize> {
    type Output = Self;
    fn sub(self, rhs: usize) -> Self::Output {
        let rhs = rhs % MOD;
        let lhs = self.0 + if self.0 < rhs { MOD } else { 0 };
        Mint(lhs - rhs)
    }
}

impl Sub for Mint<usize> {
    type Output = Self;
    fn sub(self, rhs: Self) -> Self::Output {
        self - rhs.0
    }
}

impl SubAssign<usize> for Mint<usize> {
    fn sub_assign(&mut self, rhs: usize) {
        *self = *self - rhs
    }
}

impl SubAssign for Mint<usize> {
    fn sub_assign(&mut self, rhs: Self) {
        *self = *self - rhs
    }
}

impl Mul<usize> for Mint<usize> {
    type Output = Self;
    fn mul(self, rhs: usize) -> Self::Output {
        Mint((self.0 * rhs) % MOD)
    }
}

impl Mul for Mint<usize> {
    type Output = Self;
    fn mul(self, rhs: Self) -> Self::Output {
        self * rhs.0
    }
}

impl MulAssign for Mint<usize> {
    fn mul_assign(&mut self, rhs: Self) {
        *self = *self * rhs;
    }
}

impl Div<usize> for Mint<usize> {
    type Output = Self;
    fn div(self, rhs: usize) -> Self::Output {
        self * Mint(rhs).pow(MOD - 2)
    }
}

impl Div for Mint<usize> {
    type Output = Self;
    fn div(self, rhs: Self) -> Self::Output {
        self / rhs.0
    }
}

impl DivAssign<usize> for Mint<usize> {
    fn div_assign(&mut self, rhs: usize) {
        *self = *self / rhs;
    }
}
impl DivAssign for Mint<usize> {
    fn div_assign(&mut self, rhs: Self) {
        *self = *self / rhs;
    }
}

macro_rules! parse {
    ($it: ident) => {
        $it.next().unwrap().parse().unwrap()
    };
    ($it: ident,2) => {
        (parse!($it), parse!($it))
    };
    ($it: ident,3) => {
        (parse!($it), parse!($it), parse!($it))
    };
    ($it: ident,4) => {
        (parse!($it), parse!($it), parse!($it), parse!($it))
    };
    ($it: ident, $n: expr) => {
        (&mut $it).take($n).map(|e| e.parse().unwrap()).collect();
    };
}

#[derive(Clone, Copy)]
struct Ret<'a> {
    c: Mint<usize>,
    d: usize,
    comb: &'a CombMod,
}

impl<'a> Ret<'a> {
    fn new(comb: &'a CombMod) -> Self {
        Ret {
            c: Mint(1),
            d: 0,
            comb: comb,
        }
    }

    fn rooted(self) -> Self {
        Ret {
            c: self.c,
            d: self.d + 1,
            comb: self.comb,
        }
    }
}
impl<'a> Sub for Ret<'a> {
    type Output = Self;
    fn sub(self, rhs: Self) -> Self {
        let mut c = self.c / rhs.c;
        c /= self.comb.get(self.d, rhs.d);
        Ret {
            c: c,
            d: self.d - rhs.d,
            comb: self.comb,
        }
    }
}

impl<'a> SubAssign for Ret<'a> {
    fn sub_assign(&mut self, rhs: Self) {
        *self = *self - rhs;
    }
}

impl<'a> Add for Ret<'a> {
    type Output = Self;
    fn add(self, rhs: Self) -> Self {
        let mut c = self.c * rhs.c;
        c *= self.comb.get(self.d + rhs.d, self.d);
        Ret {
            c: c,
            d: self.d + rhs.d,
            comb: self.comb,
        }
    }
}

impl<'a> AddAssign for Ret<'a> {
    fn add_assign(&mut self, rhs: Self) {
        *self = *self + rhs;
    }
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    let n: usize = parse!(it);
    let mut g = vec![vec![]; n];
    let comb = CombMod::new(1000000);
    for _ in 0..(n - 1) {
        let (a, b): (usize, usize) = parse!(it, 2);
        g[a - 1].push(b - 1);
        g[b - 1].push(a - 1);
    }

    let mut dp = vec![Ret::new(&comb); n];
    let mut seen = vec![false; n];
    seen[0] = true;
    fn dfs(g: &Vec<Vec<usize>>, u: usize, seen: &mut Vec<bool>, dp: &mut Vec<Ret>) {
        for &v in &g[u] {
            if !seen[v] {
                seen[v] = true;
                dfs(g, v, seen, dp);
                let d = dp[v].rooted();
                dp[u] += d;
            }
        }
    }
    dfs(&mut g, 0, &mut seen, &mut dp);

    let mut seen = vec![false; n];
    seen[0] = true;
    fn dfs2(g: &Vec<Vec<usize>>, u: usize, seen: &mut Vec<bool>, dp: &mut Vec<Ret>) {
        for &v in &g[u] {
            if !seen[v] {
                seen[v] = true;
                let d = dp[u] - dp[v].rooted();
                dp[v] += d.rooted();
                dfs2(g, v, seen, dp);
            }
        }
    }
    dfs2(&mut g, 0, &mut seen, &mut dp);

    for i in 0..n {
        println!("{}", dp[i].c.0);
    }
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}


Measured memory_bytes: 47224