using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }
    static void Solve()
    {
        var N = sc.ReadInt();
        var rerooting = new Rerooting(N);
        for (int i = 0; i < N - 1; i++)
        {
            var a = sc.ReadInt();
            var b = sc.ReadInt();
            a--; b--;
            rerooting.AddEdge(a, b);
            rerooting.AddEdge(b, a);
        }
        var res = rerooting.Build();
        for (int i = 0; i < N; i++)
        {
            var ans = res[i].Comb;
            Console.WriteLine(ans);
        }
    }

    class Rerooting
    {
        /*
         * 型Data: DPテーブルに記録するデータ型
         * Identity: DPテーブルの初期値(単位元)
         * Merge: 部分木の計算結果をマージする二項演算
         * AddRoot: 部分木のマージ結果から現在の頂点を根とする部分木の答えを計算する関数
         */
        // DPテーブルに記録する型
        public struct Data
        {
            public ModInt Comb;
            public int NodeCount;
            public Data(ModInt comb, int nodeCount)
            {
                this.Comb = comb;
                this.NodeCount = nodeCount;
            }
            public override string ToString()
            {
                return this.Comb.ToString() + " " + NodeCount;
            }
        }
        public readonly Data Identity = new Data(1, 0);
        private Data Merge(Data a, Data b)
        {
            var newCount = a.NodeCount + b.NodeCount;
            var comb = a.Comb * b.Comb * ModInt.Fac(newCount)
                    * ModInt.iFac(a.NodeCount) * ModInt.iFac(b.NodeCount);
            return new Data(comb, newCount);
        }
        private Data AddRoot(Data accum)
        {
            var comb = accum.Comb;
            var newCount = accum.NodeCount + 1;
            return new Data(comb, newCount);
        }

        public class Edge
        {
            public int From;
            public int To;
            public long Cost;
            public Edge(int from, int to, long cost = 1)
            {
                this.From = from;
                this.To = to;
                this.Cost = cost;
            }
        }
        // --------------------

        public List<Edge>[] G;
        public Data[] Ans;
        public Data[][] DP;
        public int N;
        public Rerooting(int n)
        {
            N = n;
            G = new List<Edge>[N];
            Ans = Enumerable.Repeat(Identity, N).ToArray();
            for (int i = 0; i < N; i++)
            {
                G[i] = new List<Edge>();
            }
        }
        public void AddEdge(int a, int b, long cost = 1)
        {
            G[a].Add(new Edge(a, b, cost));
        }
        public Data[] Build()
        {
            // DPテーブルの初期化
            DP = new Data[N][];
            for (int i = 0; i < N; i++)
            {
                // 初期値 Identity
                DP[i] = Enumerable.Repeat(Identity, G[i].Count).ToArray();
            }

            // 行きがけ順と頂点0を根とするときの親を記録しておく
            var order = new List<int>();
            var parents = new int[N];
            var parentsIndex = new int[N];
            parentsIndex[0] = -1;
            var stack = new Stack<int>();
            stack.Push(0);
            while (stack.Count > 0)
            {
                // 行きがけの頂点を記録
                var now = stack.Pop();
                for (int i = 0; i < G[now].Count; i++)
                {
                    var e = G[now][i];
                    var next = e.To;
                    if (parents[now] == next) continue;
                    // 親頂点とインデックスを記録
                    parents[next] = now;
                    parentsIndex[next] = i;
                    stack.Push(next);
                }
                order.Add(now);
            }

            // dfs1
            // 頂点0を根とする部分木について帰りがけ順で計算
            for (int i = N - 1; i >= 0; i--)
            {
                var now = order[i];
                var accum = Identity;
                for (int j = 0; j < G[now].Count; j++)
                {
                    var e = G[now][j];
                    var next = e.To;
                    if (parents[now] == next) continue;
                    accum = Merge(accum, DP[now][j]);
                }
                if (parentsIndex[now] == -1) continue;
                DP[parents[now]][parentsIndex[now]] = AddRoot(accum);
            }

            // dfs2
            // 計算されていない向きの部分木について行きがけ順で計算
            var q = new Queue<Tuple<int, int, Data>>();
            q.Enqueue(Tuple.Create(0, -1, Identity));
            while (q.Count > 0)
            {
                var t = q.Dequeue();
                var now = t.Item1;
                var prev = t.Item2;
                var data = t.Item3;
                var deg = G[now].Count;

                // dfs1で計算してない向きに対応する部分木のDPを保存
                for (int i = 0; i < deg; i++)
                {
                    // この時点で頂点DP[now]の表はすべて埋まる
                    if (G[now][i].To == prev) DP[now][i] = data;
                }

                // 累積マージの計算結果を保持する配列
                var CumL = Enumerable.Repeat(Identity, deg + 1).ToArray();
                var CumR = Enumerable.Repeat(Identity, deg + 1).ToArray();
                for (int i = 0; i < deg; i++)
                {
                    CumL[i + 1] = Merge(CumL[i], DP[now][i]);
                }
                for (int i = deg - 1; i >= 0; i--)
                {
                    CumR[i] = Merge(CumR[i + 1], DP[now][i]);
                }

                // 現在の頂点を根とする木の計算結果を更新する
                Ans[now] = AddRoot(CumL[deg]);

                // i番目の辺を除いたマージ結果をもって隣接する頂点に移る
                for (int i = 0; i < deg; i++)
                {
                    var e = G[now][i];
                    var next = e.To;
                    if (next == prev) continue;
                    // i番目の辺以外のマージ結果を計算
                    // マージ結果に頂点を追加して部分木のデータとする
                    var nextData = AddRoot(Merge(CumL[i], CumR[i + 1]));
                    var tup = Tuple.Create(next, now, nextData);
                    q.Enqueue(tup);
                }
            }

            return Ans;
        }
    }

    public struct ModInt
    {
        public const long Mod = (int)1e9 + 7;
        public long num;
        public ModInt(long n) { num = n; }
        public override string ToString() { return num.ToString(); }
        public static ModInt operator +(ModInt l, ModInt r) { l.num += r.num; if (l.num >= Mod) l.num -= Mod; return l; }
        public static ModInt operator -(ModInt l, ModInt r) { l.num -= r.num; if (l.num < 0) l.num += Mod; return l; }
        public static ModInt operator *(ModInt l, ModInt r) { return new ModInt(l.num * r.num % Mod); }
        public static ModInt operator /(ModInt l, ModInt r) { return l * Inverse(r); }
        public static implicit operator ModInt(long n) { n %= Mod; if (n < 0) n += Mod; return new ModInt(n); }
        public static ModInt Pow(ModInt v, long k) { return Pow(v.num, k); }
        public static ModInt Pow(long v, long k)
        {
            long ret = 1;
            for (k %= Mod - 1; k > 0; k >>= 1, v = v * v % Mod)
                if ((k & 1) == 1) ret = ret * v % Mod;
            return new ModInt(ret);
        }
        public static ModInt Inverse(ModInt v) { return Pow(v, Mod - 2); }
        private static List<ModInt> Facs = new List<ModInt> { 1 };
        private static List<ModInt> iFacs = new List<ModInt> { 1 };
        public static ModInt Fac(int n)
        {
            for (int i = Facs.Count; i <= n; i++)
            {
                Facs.Add(i * Facs[i - 1]);
                iFacs.Add(Inverse(Facs[i]));
            }
            return Facs[n];
        }
        public static ModInt iFac(int n)
        {
            Fac(n);
            return iFacs[n];
        }
        public static ModInt nCr(int n, int r)
        {
            if (n < r) return 0;
            if (n == r) return 1;
            if (n > (int)1e6) return nCrLoop(n, r);
            return Fac(n) * iFac(r) * iFac(n - r);
        }
        static ModInt nCrLoop(long n, long r)
        {
            ModInt num = 1;
            for (long i = 1; i <= r; i++)
            {
                num = num * (n - i + 1) / i;
            }
            return num;
        }
        public static ModInt nHr(int n, int r)
        {
            return nCr(n + r - 1, r);
        }
    }
    static Scanner sc = new Scanner();
}
class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }
    public string ReadStr()
    {
        return this.Next();
    }
    public char ReadChar()
    {
        return this.Next()[0];
    }
    public int ReadInt()
    {
        return int.Parse(this.Next());
    }
    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }
    public long ReadLong()
    {
        return long.Parse(this.Next());
    }
    public double ReadDouble()
    {
        return double.Parse(this.Next());
    }
    public Tuple<int, int> ReadTup(int add = 0)
    {
        return Tuple.Create(this.ReadInt() + add, this.ReadInt() + add);
    }
    public Tuple<long, long> ReadTupLong(int add = 0)
    {
        return Tuple.Create(this.ReadLong() + add, this.ReadLong() + add);
    }
    public Tuple<int, int, int> ReadTup3(int add = 0)
    {
        return Tuple.Create(this.ReadInt() + add, this.ReadInt() + add, this.ReadInt() + add);
    }
    public Tuple<int, int, int, int> ReadTup4(int add = 0)
    {
        return Tuple.Create(this.ReadInt() + add, this.ReadInt() + add, this.ReadInt() + add, this.ReadInt() + add);
    }
    public int[] ReadIntArray(int n)
    {
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }
    public long[] ReadLongArray(int n)
    {
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }
    public double[] ReadDoubleArray(int n)
    {
        var array = new double[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadDouble();
        }
        return array;
    }
    public char[] ReadCharArray(int n)
    {
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }
    public string[] ReadStrArray(int n)
    {
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
    public Tuple<long, long>[] ReadTupLongArray(int n, int add = 0)
    {
        var array = new Tuple<long, long>[n];
        for (int i = 0; i < n; i++)
        {
            array[i] = this.ReadTupLong(add);
        }
        return array;
    }
    public Tuple<int, int>[] ReadTupArray(int n, int add = 0)
    {
        var array = new Tuple<int, int>[n];
        for (int i = 0; i < n; i++)
        {
            array[i] = this.ReadTup(add);
        }
        return array;
    }
    public Tuple<int, int, int>[] ReadTup3Array(int n, int add = 0)
    {
        var array = new Tuple<int, int, int>[n];
        for (int i = 0; i < n; i++)
        {
            array[i] = this.ReadTup3(add);
        }
        return array;
    }
    public Tuple<int, int, int, int>[] ReadTup4Array(int n, int add = 0)
    {
        var array = new Tuple<int, int, int, int>[n];
        for (int i = 0; i < n; i++)
        {
            array[i] = this.ReadTup4(add);
        }
        return array;
    }
}


Measured memory_bytes: 111396