#include <bits/stdc++.h>

#define REP(i,n) for (int i=0;i<(n);++i)
#define MOD 1000000007

using namespace std;

using ll = long long;

template <class T, T M>
class modulo {
public:
    T data;

    modulo(T data = 0) : data(data % M) {
    }

    modulo operator+(const modulo &x) const {
        return modulo(data + x.data);
    }

    modulo operator-(const modulo &x) const {
        return modulo(data + (M - x.data));
    }

    modulo operator*(const modulo &x) const {
        return modulo(data * x.data);
    }

    modulo operator/(const modulo &x) const {
        return modulo(data * x.inv().data);
    }

    modulo operator+=(const modulo &x) {
        return data = (data + x.data) % M;
    }

    modulo operator-=(const modulo &x) {
        return data = (data + (M - x.data)) % M;
    }

    modulo operator*=(const modulo &x) {
        return data = (data * x.data) % M;
    }

    modulo operator/=(const modulo &x) {
        return data = (data * x.inv().data) % M;
    }

    modulo inv() const {
        return _pow(M - 2);
    }

    template <class Integer>
    modulo operator^(Integer n) const {
        if (n >= 0) {
            return _pow(n);
        } else {
            return _pow(M - 1 - (-n) % (M - 1));
        }
    }

    friend std::ostream& operator<<(std::ostream &os, const modulo &x) {
        os << x.data;
        return os;
    }

private:
    template <class NonNegativeInteger>
    modulo _pow(NonNegativeInteger n) const {
        modulo result(1);
        modulo x(*this);
        while (n) {
            if (n & 1) {
                result *= x;
            }
            x *= x;
            n >>= 1;
        }
        return result;
    }
};

template <class T, T M>
struct combinatorics {

    using Mod = modulo<T, M>;

    T N;
    std::vector<Mod> factorial;
    std::vector<Mod> inv_factorial;

    combinatorics(T N) : N(N), factorial(N + 1), inv_factorial(N + 1) {
        factorial[0] = 1;
        for (T i = 1; i <= N; ++i) {
            factorial[i] = factorial[i - 1] * i;
        }
        inv_factorial[N] = factorial[N].inv();
        for (T i = N; i >= 1; --i) {
            inv_factorial[i - 1] = inv_factorial[i] * i;
        }
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    using mod = modulo<ll, MOD>;

    int N;
    cin >> N;
    vector<vector<int>> g(N);
    REP(i, N - 1) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    const int root = 0;
    combinatorics<ll, MOD> combi(N);

    vector<int> sizes(N);
    function<int(int, int)> dfs_size = [&](int u, int p) {
        int result = 1;
        for (int v: g[u]) {
            if (v == p) {
                continue;
            }
            result += dfs_size(v, u);
        }
        return sizes[u] = result;
    };
    dfs_size(root, -1);

    vector<mod> f_down(N);
    function<mod(int, int)> dfs_f_down = [&](int u, int p) {
        mod result = combi.factorial[sizes[u] - 1];
        for (int v: g[u]) {
            if (v == p) {
                continue;
            }
            result *= dfs_f_down(v, u) / combi.factorial[sizes[v]];
        }
        return f_down[u] = result;
    };
    dfs_f_down(root, -1);

    vector<mod> f(N);
    function<void(int, int, mod)> dfs_f = [&](int u, int p, mod f_p) {
        mod result = combi.factorial[N - 1] / combi.factorial[N - sizes[u]] * f_p;
        for (int v: g[u]) {
            if (v == p) {
                continue;
            }
            result *= f_down[v] / combi.factorial[sizes[v]];
        }
        f[u] = result;
        for (int v: g[u]) {
            if (v == p) {
                continue;
            }
            dfs_f(v, u, f[u] * combi.factorial[N - 1 - sizes[v]] / combi.factorial[N - 1] * combi.factorial[sizes[v]] / f_down[v]);
        }
    };
    dfs_f(root, -1, 1);

    REP(i, N) {
        cout << f[i] << '\n';
    }
    cout << flush;

    return 0;
}


Measured memory_bytes: 20980