#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 1000000000
#define InfLL 1000000000000000000LL
#define nmax_def 220000
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=(n-1);(i)>=(0);(i)--)
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

vector<vl> pow_;
vi plist;
void pow_ini() {
	int len = plist.size();
	rep(i, len) {
		ll ptmp = plist[i];
		vl powtmp;
		powtmp.push_back(ptmp);
		rep(j, 62) {
			ll nxt = powtmp[j] * powtmp[j];
			nxt %= mod;
			powtmp.push_back(nxt);
		}
		pow_.push_back(powtmp);
	}
	return;
}

ll pow1(ll i, ll b) {
	ll ans = 1;
	rep(n, 62) {
		if ((b >> n) % 2 == 1) {
			ans *= pow_[i][n];
			ans %= mod;
		}
	}
	return ans;
}

class Graph_class {
public:
	bool graph_from1 = true;
	bool graph_tree = true;
	bool graph_weight = false;
	bool graph_digraph = false;
	int Vnum;
	int Enum;
	vector<pii> edgelist;
	vl edgeweight;
	vector<vi> adjlist;
	vector<vl> adjlistweight;
	vi adjnum;

	vi adj_to_root;
	vector<int> DP;
	vi vlist_from_root;
	vl xdist;

	vb x_visited;
	deque<int> x_que;


	ll ans = 1;
	vl anslist;

	void read_edge();
	void read_edge_array();
	void adjini();
	void visited_ini();
	void graph_BFS(ll BFS_ini);
	void graph_DFS(ll DFS_ini);
	void graph_DFS_sbrt(ll DFS_ini);
	void Dijkstra(int x);
	bool Bellman_Ford(int x);
	ll diameter();
	void ReRooting(ll root);
	Graph_class Kruskal();
	int dim_num(int dim);
	void solve();

	bool xydist_def = false;
};

// ----- graph -----

void Graph_class::read_edge() {
	cin >> Vnum;
	if (graph_tree)
		Enum = Vnum - 1;// graph
	else
		cin >> Enum;
	edgelist.resize(Enum);
	edgeweight.resize(Enum, 1);
	rep(i, Enum) {
		if (graph_weight)
			cin >> edgelist[i].first >> edgelist[i].second >> edgeweight[i];
		else
			cin >> edgelist[i].first >> edgelist[i].second;
		if (graph_from1) {
			edgelist[i].first--;
			edgelist[i].second--;
		}
	}
	return;
}

void Graph_class::adjini() {
	adjnum.resize(Vnum);
	xdist.resize(Vnum, -1);
	adjlist.resize(Vnum);
	if (graph_weight)
		adjlistweight.resize(Vnum);
	adj_to_root.resize(Vnum, -1);
	DP.resize(Vnum, 0);
	rep(i, Vnum)
		adjnum[i] = 0;
	rep(i, Enum) {
		int x = edgelist[i].first;
		int y = edgelist[i].second;
		adjlist[x].push_back(y);
		if (!graph_digraph)
			adjlist[y].push_back(x);
		if (graph_weight) {
			ll xyweight = edgeweight[i];
			adjlistweight[x].push_back(xyweight);
			if (!graph_digraph)
				adjlistweight[y].push_back(xyweight);
		}
		adjnum[x]++;
		if (!graph_digraph)
			adjnum[y]++;
	}
	x_visited.resize(Vnum);
	visited_ini();

	return;
}

void Graph_class::visited_ini() {
	rep(i, Vnum) {
		x_visited[i] = false;
		adj_to_root[i] = -1;
	}
	x_que.clear();
}

void Graph_class::graph_BFS(ll BFS_ini) {
	visited_ini();
	x_que.push_back(BFS_ini);
	x_visited[BFS_ini] = true;

	// option
	xdist[BFS_ini] = 0;
	vlist_from_root.clear();
	vlist_from_root.push_back(BFS_ini);
	//cout << BFS_ini << endl;

	while (!x_que.empty()) {
		int x = x_que.front();
		x_que.pop_front();
		rep(i, adjnum[x]) {
			int x_new = adjlist[x][i];
			int dist_new = 1;
			if (graph_weight)
				dist_new = adjlistweight[x][i];
			if (!x_visited[x_new]) {
				x_visited[x_new] = true;
				x_que.push_back(x_new);

				// option
				adj_to_root[x_new] = x;
				vlist_from_root.push_back(x_new);
				xdist[x_new] = xdist[x] + dist_new;
				//cout << x_new << endl;
			}
		}
	}
	return;
}

void Graph_class::graph_DFS(ll DFS_ini) {
	visited_ini();
	x_que.push_back(DFS_ini);
	x_visited[DFS_ini] = true;

	while (!x_que.empty()) {
		int x = x_que.back();
		x_que.pop_back();

		// option
		//cout << x << endl;

		rep(i, adjnum[x]) {
			int x_new = adjlist[x][i];
			if (!x_visited[x_new]) {
				x_visited[x_new] = true;
				x_que.push_back(x_new);
			}
		}
	}
	return;
}


void Graph_class::ReRooting(ll root) {
	rep(i, Vnum) {
		DP[i] = 1;
	}
	graph_BFS(root);
	rrep(i, Vnum) { // 根から遠い点から見る
		ll x = vlist_from_root[i];
		rep(j, adjnum[x]) {
			ll x_new = adjlist[x][j];
			if (x_new == adj_to_root[x]) // 根側
				continue;
			DP[x] += DP[x_new];
		}
	}
	return;
}

void Graph_class::solve() {
	ReRooting(0);
	rep(i, Vnum) {
		ans *= (i + 1);
		ans %= mod;
	}
	rep(i, Vnum) {
		ans *= pow1(DP[i], mod - 2);
		ans %= mod;
	}
	anslist.resize(Vnum);
	anslist[0] = ans;
	rep(i, Vnum) {
		if (i == 0)
			continue;
		int x = vlist_from_root[i];
		int xprev = adj_to_root[x];
		anslist[x] = anslist[xprev];
		anslist[x] *= DP[x];
		anslist[x] %= mod;
		anslist[x] *= pow1(Vnum - DP[x], mod - 2);
		anslist[x] %= mod;
	}
	rep(i, Vnum) {
		cout << anslist[i] << "\n";
	}

	//Graph_class tree = Kruskal();
	return;
}

int main(void) {
	rep(i, 220000)
		plist.push_back(i);
	pow_ini();
	Graph_class graph;
	graph.read_edge();
	graph.adjini();
	graph.solve();
	return 0;
}

Measured memory_bytes: 140520