macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};
use std::collections::HashMap;

fn main() {
    input!{
        n: usize,
        v: [(usize1, usize1); n - 1]
    }
    let mut t = vec![vec![]; n];
    for &(a, b) in &v {
        t[a].push(b);
        t[b].push(a);
    }
    let d = 1000000007;
    let mut st = vec![1; n + 1];
    for i in 1..n {
        st[i] = st[i - 1] * i % d;
    }
    let sti: Vec<usize> = st.iter().map(|&x| inv_m(x, d)).collect();
    let mut np = HashMap::new();
    dfs1(0, 0, &t, &mut np, &st, &sti, d);
    println!("{}", np.get(&(0, 0)).unwrap().1);
    for &v in &t[0] {
        dfs2(v, 0, &t, &mut np, &st, &sti, d);
    }
    for i in 1..n {
        println!("{}", np.get(&(i, i)).unwrap().1);
    }
}

fn dfs1(v: usize, r: usize, t: &Vec<Vec<usize>>, np: &mut HashMap<(usize, usize), (usize, usize)>, st: &Vec<usize>, sti: &Vec<usize>, d: usize) {
    let mut n = 1;
    let mut p = 1;
    for &c in &t[v] {
        if c == r {
            continue;
        }
        dfs1(c, v, t, np, st, sti, d);
        let (ni, pi) = *np.get(&(v, c)).unwrap();
        n += ni;
        p = p * pi % d * sti[ni] % d;
    }
    p = p * st[n - 1] % d;
    np.insert((r, v), (n, p));
}

fn dfs2(v: usize, r: usize, t: &Vec<Vec<usize>>, np: &mut HashMap<(usize, usize), (usize, usize)>, st: &Vec<usize>, sti: &Vec<usize>, d: usize) {
    let (nr, pr) = *np.get(&(r, r)).unwrap();
    let (nv, pv) = *np.get(&(r, v)).unwrap();
    let n1 = nr - nv;
    let p1 = pr * st[nr - nv - 1] % d * sti[nr - 1] % d * st[nv] % d * inv_m(pv, d) % d;
    np.insert((v, r), (n1, p1));
    np.insert((v, v), (nv + n1, pv * sti[nv - 1] % d * st[nv - 1 + n1] % d * sti[n1] % d * p1 % d));
    for &c in &t[v] {
        if c == r {
            continue;
        }
        dfs2(c, v, t, np, st, sti, d);
    }
}

fn pow_m(n: usize, mut p: usize, d: usize) -> usize {
    let mut r = n;
    let mut ret = 1;
    while p > 0 {
        if p % 2 == 0 {
            r = r * r % d;
            p /= 2;
        } else {
            ret = ret * r % d;
            p -= 1;
        }
    }
    ret
}

fn inv_m(n: usize, d: usize) -> usize {
    pow_m(n, d - 2, d)
}


Measured memory_bytes: 87820