fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    let mut solver = Solver::new(n);
    for _ in 0..n - 1 {
        solver.add_edge(scan(tokens), scan(tokens));
    }
    solver.solve();
}

const MODULO: usize = 1_000_000_007;

struct Solver {
    n: usize,
    edges: Vec<Vec<usize>>,
    parent: Vec<usize>,
    c: Vec<usize>,
    x: Vec<usize>,
    y: Vec<usize>,
    f: Vec<usize>,
}

impl Solver {
    fn new(n: usize) -> Solver {
        let mut f = vec![0; n + 1];
        f[0] = 1;
        for i in 1..f.len() {
            f[i] = i * f[i - 1] % MODULO;
        }
        Solver {
            n: n,
            edges: vec![Vec::new(); n + 1],
            parent: vec![0; n + 1],
            c: vec![0; n + 1],
            x: vec![0; n + 1],
            y: vec![0; n + 1],
            f: f,
        }
    }
    fn add_edge(&mut self, a: usize, b: usize) {
        self.edges[a].push(b);
        self.edges[b].push(a);
    }
    fn solve(&mut self) {
        self.dfs(1);
        self.dfs2(1);
        for i in 1..self.n + 1 {
            if i == 1 {
                println!("{}", self.x[i]);
            } else {
                let mut z = self.y[i];
                z = z * inverse(self.f[self.n - self.c[i]]) % MODULO;
                z = z * self.x[i] % MODULO;
                z = z * inverse(self.f[self.c[i] - 1]) % MODULO;
                z = z * self.f[self.n - 1] % MODULO;
                println!("{}", z);
            }
        }
    }
    fn dfs(&mut self, i: usize) {
        let mut c = 1;
        let mut x = 1;
        for idx in 0..self.edges[i].len() {
            let j = self.edges[i][idx];
            if j != self.parent[i] {
                self.parent[j] = i;
                self.dfs(j);
                c = c + self.c[j];
                x = x * self.x[j] % MODULO;
                x = x * inverse(self.f[self.c[j]]) % MODULO;
            }
        }
        x = x * self.f[c - 1] % MODULO;
        self.c[i] = c;
        self.x[i] = x;
    }
    fn dfs2(&mut self, i: usize) {
        if i == 1 {
            self.y[i] = 1;
        } else {
            let p = self.parent[i];
            let mut y = 1;
            y = y * self.x[p] % MODULO;
            y = y * self.y[p] % MODULO;
            y = y * inverse(self.x[i]) % MODULO;
            y = y * self.f[self.n - self.c[i] - 1] % MODULO;
            y = y * self.f[self.c[i]] % MODULO;
            y = y * inverse(self.f[self.n - self.c[p]]) % MODULO;
            y = y * inverse(self.f[self.c[p] - 1]) % MODULO;
            self.y[i] = y;
        }
        for idx in 0..self.edges[i].len() {
            let j = self.edges[i][idx];
            if j != self.parent[i] {
                self.dfs2(j);
            }
        }
    }
}

fn power(mut b: usize, mut e: usize) -> usize {
    let mut a = 1;
    while e != 0 {
        if e & 1 != 0 {
            a = a * b % MODULO;
        }
        b = b * b % MODULO;
        e >>= 1;
    }
    a
}

fn inverse(x: usize) -> usize {
    power(x, MODULO - 2)
}


Measured memory_bytes: 32888