JerryL/AlgoSimBench huggingface dataset:
723_E. One-Way Reform

There are n cities and m two-way roads in Berland, each road connects two cities. It is known that there is no more than one road connecting each pair of cities, and there is no road which connects the city with itself. It is possible that there is no way to get from one city to some other city using only these roads.

The road minister decided to make a reform in Berland and to orient all roads in the country, i.e. to make each road one-way. The minister wants to maximize the number of cities, for which the number of roads that begins in the city equals to the number of roads that ends in it.

Input

The first line contains a positive integer t (1 ≤ t ≤ 200) — the number of testsets in the input.

Each of the testsets is given in the following way. The first line contains two integers n and m (1 ≤ n ≤ 200, 0 ≤ m ≤ n·(n - 1) / 2) — the number of cities and the number of roads in Berland. 

The next m lines contain the description of roads in Berland. Each line contains two integers u and v (1 ≤ u, v ≤ n) — the cities the corresponding road connects. It's guaranteed that there are no self-loops and multiple roads. It is possible that there is no way along roads between a pair of cities.

It is guaranteed that the total number of cities in all testset of input data doesn't exceed 200.

Pay attention that for hacks, you can only use tests consisting of one testset, so t should be equal to one.

Output

For each testset print the maximum number of such cities that the number of roads that begins in the city, is equal to the number of roads that ends in it.

In the next m lines print oriented roads. First print the number of the city where the road begins and then the number of the city where the road ends. If there are several answers, print any of them. It is allowed to print roads in each test in arbitrary order. Each road should be printed exactly once. 

Example

Input

2
5 5
2 1
4 5
2 3
1 3
3 5
7 2
3 7
4 2


Output

3
1 3
3 5
5 4
3 2
2 1
3
2 4
3 7

Example input:
2
5 5
2 1
4 5
2 3
1 3
3 5
7 2
3 7
4 2


Example output:
3
1 2
2 3
3 1
3 5
5 4
3
2 4
3 7


Tags: constructive algorithms
dfs and similar
flows
graphs
greedy
Difficulty rating: 2200

Solution:
#include <bits/stdc++.h>
using namespace std;
set<int> E[205];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; ++i) E[i].clear();
    for (int i = 1, u, v; i <= m; ++i) {
      cin >> u >> v;
      E[u].insert(v);
      E[v].insert(u);
    }
    for (int i = 1; i <= n; ++i)
      if (E[i].size() & 1) E[0].insert(i), E[i].insert(0);
    cout << n - E[0].size() << '\n';
    for (int i = 0; i <= n; ++i) {
      while (!E[i].empty()) {
        auto j = *E[i].begin();
        if (i and j) cout << i << ' ' << j << '\n';
        E[i].erase(j), E[j].erase(i);
        i = j;
      }
    }
  }
  return 0;
}
710_E. Generate a String

zscoder wants to generate an input file for some programming competition problem.

His input is a string consisting of n letters 'a'. He is too lazy to write a generator so he will manually generate the input in a text editor.

Initially, the text editor is empty. It takes him x seconds to insert or delete a letter 'a' from the text file and y seconds to copy the contents of the entire text file, and duplicate it.

zscoder wants to find the minimum amount of time needed for him to create the input file of exactly n letters 'a'. Help him to determine the amount of time needed to generate the input.

Input

The only line contains three integers n, x and y (1 ≤ n ≤ 107, 1 ≤ x, y ≤ 109) — the number of letters 'a' in the input file and the parameters from the problem statement.

Output

Print the only integer t — the minimum amount of time needed to generate the input file.

Examples

Input

8 1 1


Output

4


Input

8 1 10


Output

8

Example input:
8 1 10

8 1 1


Example output:
8
4

Tags: dfs and similar
dp
Difficulty rating: 2000

Solution:
n,x,y=map(int,input().split())
dp = [0.]*(n+1)
for i in range(1,n+1):
    dp[i]=min(dp[i-1]+x,dp[(i+1)//2]+y+(x*(i&1)))
print(int(dp[n]))
761_E. Dasha and Puzzle

Dasha decided to have a rest after solving the problem. She had been ready to start her favourite activity — origami, but remembered the puzzle that she could not solve. 

<image>

The tree is a non-oriented connected graph without cycles. In particular, there always are n - 1 edges in a tree with n vertices.

The puzzle is to position the vertices at the points of the Cartesian plane with integral coordinates, so that the segments between the vertices connected by edges are parallel to the coordinate axes. Also, the intersection of segments is allowed only at their ends. Distinct vertices should be placed at different points. 

Help Dasha to find any suitable way to position the tree vertices on the plane.

It is guaranteed that if it is possible to position the tree vertices on the plane without violating the condition which is given above, then you can do it by using points with integral coordinates which don't exceed 1018 in absolute value.

Input

The first line contains single integer n (1 ≤ n ≤ 30) — the number of vertices in the tree. 

Each of next n - 1 lines contains two integers ui, vi (1 ≤ ui, vi ≤ n) that mean that the i-th edge of the tree connects vertices ui and vi.

It is guaranteed that the described graph is a tree.

Output

If the puzzle doesn't have a solution then in the only line print "NO".

Otherwise, the first line should contain "YES". The next n lines should contain the pair of integers xi, yi (|xi|, |yi| ≤ 1018) — the coordinates of the point which corresponds to the i-th vertex of the tree.

If there are several solutions, print any of them. 

Examples

Input

7
1 2
1 3
2 4
2 5
3 6
3 7

Output

YES
0 0
1 0
0 1
2 0
1 -1
-1 1
0 2

Input

6
1 2
2 3
2 4
2 5
2 6


Output

NO


Input

4
1 2
2 3
3 4

Output

YES
3 3
4 3
5 3
6 3

Note

In the first sample one of the possible positions of tree is: <image>

Example input:
6
1 2
2 3
2 4
2 5
2 6

4
1 2
2 3
3 4
7
1 2
1 3
2 4
2 5
3 6
3 7

Example output:
NO

YES
0 0
1073741824 0
1610612736 0
1879048192 0

YES
0 0
0 1073741824
1073741824 0
0 1610612736
536870912 1073741824
1073741824 536870912
1610612736 0


Tags: constructive algorithms
dfs and similar
graphs
greedy
trees
Difficulty rating: 2000

Solution:
n = int(input())
p = [set() for i in range(n)]
for k in range(n - 1):
    u, v = map(int, input().split())
    p[u - 1].add(v - 1)
    p[v - 1].add(u - 1)

s = [(0, 0)] * n
t = [(0, 1 << 30, 7)]
l = [1, 0, -1, 0, 1]

while t:
    u, d, j = t.pop()
    x, y = s[u]
    i = 0
    for v in p[u]:
        if i == j: i += 1
        if i > 3: exit(print('NO'))
        p[v].remove(u)
        s[v] = (x + l[i] * d, y + l[i + 1] * d)
        t.append((v, d >> 1, (i + 2) % 4))
        i += 1

print('YES')
for x, y in s: print(x, y)
638_C. Road Improvement

In Berland there are n cities and n - 1 bidirectional roads. Each road connects some pair of cities, from any city you can get to any other one using only the given roads.

In each city there is exactly one repair brigade. To repair some road, you need two teams based in the cities connected by the road to work simultaneously for one day. Both brigades repair one road for the whole day and cannot take part in repairing other roads on that day. But the repair brigade can do nothing on that day.

Determine the minimum number of days needed to repair all the roads. The brigades cannot change the cities where they initially are.

Input

The first line of the input contains a positive integer n (2 ≤ n ≤ 200 000) — the number of cities in Berland.

Each of the next n - 1 lines contains two numbers ui, vi, meaning that the i-th road connects city ui and city vi (1 ≤ ui, vi ≤ n, ui ≠ vi).

Output

First print number k — the minimum number of days needed to repair all the roads in Berland.

In next k lines print the description of the roads that should be repaired on each of the k days. On the i-th line print first number di — the number of roads that should be repaired on the i-th day, and then di space-separated integers — the numbers of the roads that should be repaired on the i-th day. The roads are numbered according to the order in the input, starting from one.

If there are multiple variants, you can print any of them.

Examples

Input

4
1 2
3 4
3 2


Output

2
2 2 1
1 3


Input

6
3 4
5 4
3 2
1 3
4 6


Output

3
1 1 
2 2 3 
2 4 5 

Note

In the first sample you can repair all the roads in two days, for example, if you repair roads 1 and 2 on the first day and road 3 — on the second day.

Example input:
6
3 4
5 4
3 2
1 3
4 6

4
1 2
3 4
3 2


Example output:
3
2 4 2
1 1
2 5 3

2
2 1 2 
1 3 


Tags: *special
dfs and similar
graphs
greedy
trees
Difficulty rating: 1800

Solution:
import sys
mx=2*10**5+10
g=[[] for _ in range(mx)]
days=[[] for _ in range(mx)]
maxi=-1
n=int(raw_input())
t=sys.stdin.read().split("\n")
for i in range(n-1):
   l=t[i]
   u,v=map(int,l.split())
   g[u].append((v,i+1))
   g[v].append((u,i+1))

q=[(1,1,-1) for i in range(n)]
h,t=0,1
while h<t:
   u,pu,c=q[h][0],q[h][1],q[h][2]
   h+=1
   maxi=max(maxi,c);
   color=0
   for uv in g[u]:
      v,euv=uv[0],uv[1]
      if v!=pu:
         if color==c: color+=1
         days[color].append(euv)
         q[t]=(v,u,color)
         t+=1
         color+=1
print(maxi+1)
for i in range(maxi+1):
   print len(days[i]),' '.join(map(str,days[i]))
841_D. Leha and another game about graph

Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can not contain self loops. Each vertex has an integer di, which can be equal to 0, 1 or  - 1. To pass the level, he needs to find a «good» subset of edges of the graph or say, that it doesn't exist. Subset is called «good», if by by leaving only edges from this subset in the original graph, we obtain the following: for every vertex i, di = - 1 or it's degree modulo 2 is equal to di. Leha wants to pass the game as soon as possible and ask you to help him. In case of multiple correct answers, print any of them.

Input

The first line contains two integers n, m (1 ≤ n ≤ 3·105, n - 1 ≤ m ≤ 3·105) — number of vertices and edges.

The second line contains n integers d1, d2, ..., dn ( - 1 ≤ di ≤ 1) — numbers on the vertices.

Each of the next m lines contains two integers u and v (1 ≤ u, v ≤ n) — edges. It's guaranteed, that graph in the input is connected.

Output

Print  - 1 in a single line, if solution doesn't exist. Otherwise in the first line k — number of edges in a subset. In the next k lines indexes of edges. Edges are numerated in order as they are given in the input, starting from 1.

Examples

Input

1 0
1


Output

-1


Input

4 5
0 0 0 -1
1 2
2 3
3 4
1 4
2 4


Output

0


Input

2 1
1 1
1 2


Output

1
1


Input

3 3
0 -1 1
1 2
2 3
1 3


Output

1
2

Note

In the first sample we have single vertex without edges. It's degree is 0 and we can not get 1.

Example input:
1 0
1

3 3
0 -1 1
1 2
2 3
1 3

2 1
1 1
1 2

4 5
0 0 0 -1
1 2
2 3
3 4
1 4
2 4


Example output:
-1

1
2

1
1

0


Tags: constructive algorithms
data structures
dfs and similar
dp
graphs
Difficulty rating: 2100

Solution:
#include <bits/stdc++.h>
using namespace std;
const int N = 300300;
int n, m, u, v, i, root = 1, d[N];
bool vis[N];
set<int> ans;
vector<pair<int, int>> edges[N];
bool dfs(int cur) {
  if (vis[cur]++) return 1;
  int degree = 0;
  for (auto& e : edges[cur]) {
    if (!dfs(e.first)) {
      degree++;
      ans.insert(e.second);
    }
  }
  return (d[cur] == -1 || degree % 2 == d[cur]);
}
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; ++i) {
    scanf("%d", d + i);
    if (d[i] == -1) {
      root = i;
    }
  }
  for (i = 1; i <= m; ++i) {
    scanf("%d %d", &u, &v);
    edges[u].push_back(make_pair(v, i));
    edges[v].push_back(make_pair(u, i));
  }
  if (!dfs(root)) {
    return cout << -1, 0;
  }
  cout << ans.size() << endl;
  for (int x : ans) printf("%d\n", x);
  return 0;
}
29_C. Mail Stamps

One day Bob got a letter in an envelope. Bob knows that when Berland's post officers send a letter directly from city «A» to city «B», they stamp it with «A B», or «B A». Unfortunately, often it is impossible to send a letter directly from the city of the sender to the city of the receiver, that's why the letter is sent via some intermediate cities. Post officers never send a letter in such a way that the route of this letter contains some city more than once. Bob is sure that the post officers stamp the letters accurately.

There are n stamps on the envelope of Bob's letter. He understands that the possible routes of this letter are only two. But the stamps are numerous, and Bob can't determine himself none of these routes. That's why he asks you to help him. Find one of the possible routes of the letter.

Input

The first line contains integer n (1 ≤ n ≤ 105) — amount of mail stamps on the envelope. Then there follow n lines with two integers each — description of the stamps. Each stamp is described with indexes of the cities between which a letter is sent. The indexes of cities are integers from 1 to 109. Indexes of all the cities are different. Every time the letter is sent from one city to another, exactly one stamp is put on the envelope. It is guaranteed that the given stamps correspond to some valid route from some city to some other city. 

Output

Output n + 1 numbers — indexes of cities in one of the two possible routes of the letter.

Examples

Input

2
1 100
100 2


Output

2 100 1 

Input

3
3 1
100 2
3 2


Output

100 2 3 1 

Example input:
2
1 100
100 2

3
3 1
100 2
3 2


Example output:
1 100 2 

1 3 2 100 


Tags: data structures
dfs and similar
graphs
implementation
Difficulty rating: 1700

Solution:
from collections import *
d, c = defaultdict(int), []
for i in range(int(input())):
    x, y = map(int, input().split())
    c += [x, y]
    d[x] += y
    d[y] += x
a, b = [q for q, k in Counter(c).items() if k == 1]
q = 0
while a != b:
    print(a)
    q, a = a, d[a] - q
print(a)
33_B. String Problem

Boy Valera likes strings. And even more he likes them, when they are identical. That's why in his spare time Valera plays the following game. He takes any two strings, consisting of lower case Latin letters, and tries to make them identical. According to the game rules, with each move Valera can change one arbitrary character Ai in one of the strings into arbitrary character Bi, but he has to pay for every move a particular sum of money, equal to Wi. He is allowed to make as many moves as he needs. Since Valera is a very economical boy and never wastes his money, he asked you, an experienced programmer, to help him answer the question: what minimum amount of money should Valera have to get identical strings. 

Input

The first input line contains two initial non-empty strings s and t, consisting of lower case Latin letters. The length of each string doesn't exceed 105. The following line contains integer n (0 ≤ n ≤ 500) — amount of possible changings. Then follow n lines, each containing characters Ai and Bi (lower case Latin letters) and integer Wi (0 ≤ Wi ≤ 100), saying that it's allowed to change character Ai into character Bi in any of the strings and spend sum of money Wi.

Output

If the answer exists, output the answer to the problem, and the resulting string. Otherwise output -1 in the only line. If the answer is not unique, output any.

Examples

Input

uayd
uxxd
3
a x 8
x y 13
d c 3


Output

21
uxyd


Input

a
b
3
a b 2
a b 3
b a 5


Output

2
b


Input

abc
ab
6
a b 4
a b 7
b a 8
c b 11
c a 3
a c 0


Output

-1

Example input:
uayd
uxxd
3
a x 8
x y 13
d c 3

abc
ab
6
a b 4
a b 7
b a 8
c b 11
c a 3
a c 0

a
b
3
a b 2
a b 3
b a 5


Example output:
21
uxyd

-1

2
b


Tags: shortest paths
Difficulty rating: 1800

Solution:
import sys
INF=10000
a=[[INF]*26 for _ in xrange(26)]
s=str(raw_input())
t=str(raw_input())
n=input()
for i in xrange(26):
    a[i][i]=0
for i in xrange(n):
    x,y,z=raw_input().split()
    x=ord(x)-97;y=ord(y)-97;z=int(z)
    a[x][y]=min(a[x][y],z)
for k in xrange(26):
    for i in xrange(26):
        for j in xrange(26):
            a[i][j]=min(a[i][j],a[i][k]+a[k][j])
m=len(s)
if m!=len(t):
    print -1
    sys.exit()
S=0;T=""
for i in xrange(m):
    w=INF;cs=ord(s[i])-97;ct=ord(t[i])-97
    for j in xrange(26):
        if a[cs][j]+a[ct][j]<w:
            w=a[cs][j]+a[ct][j]
            u=chr(j+97)
    if w==INF:
        print -1
        sys.exit()
    S+=w;T+=u
print S
print T
1454_F. Array Partition

You are given an array a consisting of n integers.

Let min(l, r) be the minimum value among a_l, a_{l + 1}, …, a_r and max(l, r) be the maximum value among a_l, a_{l + 1}, …, a_r.

Your task is to choose three positive (greater than 0) integers x, y and z such that:

  * x + y + z = n; 
  * max(1, x) = min(x + 1, x + y) = max(x + y + 1, n). 



In other words, you have to split the array a into three consecutive non-empty parts that cover the whole array and the maximum in the first part equals the minimum in the second part and equals the maximum in the third part (or determine it is impossible to find such a partition).

Among all such triples (partitions), you can choose any.

You have to answer t independent test cases.

Input

The first line of the input contains one integer t (1 ≤ t ≤ 2 ⋅ 10^4) — the number of test cases. Then t test cases follow.

The first line of the test case contains one integer n (3 ≤ n ≤ 2 ⋅ 10^5) — the length of a.

The second line of the test case contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^9), where a_i is the i-th element of a.

It is guaranteed that the sum of n does not exceed 2 ⋅ 10^5 (∑ n ≤ 2 ⋅ 10^5).

Output

For each test case, print the answer: NO in the only line if there is no such partition of a that satisfies the conditions from the problem statement. Otherwise, print YES in the first line and three integers x, y and z (x + y + z = n) in the second line.

If there are several answers, you can print any.

Example

Input


6
11
1 2 3 3 3 4 4 3 4 2 1
8
2 9 1 7 3 9 4 1
9
2 1 4 2 4 3 3 1 2
7
4 2 1 1 4 1 4
5
1 1 1 1 1
7
4 3 4 3 3 3 4


Output


YES
6 1 4
NO
YES
2 5 2
YES
4 1 2
YES
1 1 3
YES
2 1 4

Example input:
6
11
1 2 3 3 3 4 4 3 4 2 1
8
2 9 1 7 3 9 4 1
9
2 1 4 2 4 3 3 1 2
7
4 2 1 1 4 1 4
5
1 1 1 1 1
7
4 3 4 3 3 3 4


Example output:

YES
6 1 4
NO
YES
2 5 2
YES
4 1 2
YES
1 1 3
YES
2 1 4


Tags: binary search
data structures
greedy
two pointers
Difficulty rating: 2100

Solution:
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;

const int N = 200010;
const int inf = 0x3f3f3f3f;

void solve() {
	int n;
	static int a[N], pp[N], qq[N];

	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
	}
	pp[0] = -inf;
	for (int i = 1; i <= n; ++i)
		pp[i] = max(pp[i - 1], a[i]);
	qq[n + 1] = -inf;
	for (int i = n; i >= 1; --i)
		qq[i] = max(qq[i + 1], a[i]);
	vector<int> tt;
	for (int i = 1; i <= n; ++i)
		if (a[i] == pp[n])
			tt.push_back(i);
	int l = tt[tt.size() / 2], r = tt[tt.size() / 2];
	int m = a[l];
	while (l > 1 && r < n) {
		if (pp[l - 1] == qq[r + 1] && m == pp[l - 1]) {
			cout << "YES\n";
			cout << l - 1 << ' ' << r - l + 1 << ' ' << n - r << '\n';
			return;
		}
		if (min(a[l - 1], pp[l - 2]) > min(qq[r + 2], a[r + 1]))
			m = min(a[--l], m);
		else
			m = min(a[++r], m);
	}
	cout << "NO\n";
}

int main() {
	cin.tie(0)->sync_with_stdio(0);
	int t; cin >> t;
	while (t--)
		solve();
}
p02579 AtCoder Beginner Contest 176 - Wizard in Maze

A maze is composed of a grid of H \times W squares - H vertical, W horizontal.

The square at the i-th row from the top and the j-th column from the left - (i,j) - is a wall if S_{ij} is `#` and a road if S_{ij} is `.`.

There is a magician in (C_h,C_w). He can do the following two kinds of moves:

* Move A: Walk to a road square that is vertically or horizontally adjacent to the square he is currently in.
* Move B: Use magic to warp himself to a road square in the 5\times 5 area centered at the square he is currently in.



In either case, he cannot go out of the maze.

At least how many times does he need to use the magic to reach (D_h, D_w)?

Constraints

* 1 \leq H,W \leq 10^3
* 1 \leq C_h,D_h \leq H
* 1 \leq C_w,D_w \leq W
* S_{ij} is `#` or `.`.
* S_{C_h C_w} and S_{D_h D_w} are `.`.
* (C_h,C_w) \neq (D_h,D_w)

Input

Input is given from Standard Input in the following format:


H W
C_h C_w
D_h D_w
S_{11}\ldots S_{1W}
\vdots
S_{H1}\ldots S_{HW}


Output

Print the minimum number of times the magician needs to use the magic. If he cannot reach (D_h,D_w), print `-1` instead.

Examples

Input

4 4
1 1
4 4
..#.
..#.
.#..
.#..


Output

1


Input

4 4
1 4
4 1
.##.


.##.


Output

-1


Input

4 4
2 2
3 3
....
....
....
....


Output

0


Input

4 5
1 2
2 5
.###
.
..##
..##


Output

2

Example input:
4 4
1 1
4 4
..#.
..#.
.#..
.#..
4 4
1 4
4 1
.##.


.##.
4 5
1 2
2 5
.###
.
..##
..##
4 4
2 2
3 3
....
....
....
....

Example output:
1
-1
2
0

Difficulty rating: 0

Solution:
from collections import*
(h,w),(s,t),(f,g)=eval('map(int,input().split()),'*3)
d=eval('[-1]*w,input(),'*h)
q=deque([(s-1,t-1,0)])
while q:
 y,x,c=q.pop()
 if d[y+y][x]<0:
  for a in range(25):a,b=a//5-2,a%5-2;i=a+y;j=b+x;d[y+y][x]=c;h>i>-1<j<w!=d[i-~i][j]>'#'!=(abs(a)+abs(b)<2!=q.append((i,j,c)),q.appendleft((i,j,c+1)))
print(d[f+f-2][g-1])
p03991 AtCoder Grand Contest 005 - Many Easy Problems

One day, Takahashi was given the following problem from Aoki:

* You are given a tree with N vertices and an integer K. The vertices are numbered 1 through N. The edges are represented by pairs of integers (a_i, b_i).
* For a set S of vertices in the tree, let f(S) be the minimum number of the vertices in a subtree of the given tree that contains all vertices in S.
* There are <image> ways to choose K vertices from the trees. For each of them, let S be the set of the chosen vertices, and find the sum of f(S) over all <image> ways.
* Since the answer may be extremely large, print it modulo 924844033(prime).



Since it was too easy for him, he decided to solve this problem for all K = 1,2,...,N.

Constraints

* 2 ≦ N ≦ 200,000
* 1 ≦ a_i, b_i ≦ N
* The given graph is a tree.

Input

The input is given from Standard Input in the following format:


N
a_1 b_1
a_2 b_2
:
a_{N-1} b_{N-1}


Output

Print N lines. The i-th line should contain the answer to the problem where K=i, modulo 924844033.

Examples

Input

3
1 2
2 3


Output

3
7
3


Input

4
1 2
1 3
1 4


Output

4
15
13
4


Input

7
1 2
2 3
2 4
4 5
4 6
6 7


Output

7
67
150
179
122
45
7

Example input:
3
1 2
2 3
4
1 2
1 3
1 4
7
1 2
2 3
2 4
4 5
4 6
6 7

Example output:
3
7
3
4
15
13
4
7
67
150
179
122
45
7

Difficulty rating: 0

Solution:
#include<cstdio>
#define M 524288
#define N 200001
#define p 924844033
inline int calc(int x,int y)
{
	int z=1;
	for(;y;x=1ll*x*x%p,y>>=1)if(y&1)z=1ll*z*x%p;
	return z;
}
int a[N],b[N<<1],c[N<<1],d[N],e[N],f[M],l[M],m,n,r[M],s[N],t,w[M|1],x,y;
inline void NTT(int*o,int u)
{
	for(int i=0;i<m;i++)if(f[i]>i)t=o[f[i]],o[f[i]]=o[i],o[i]=t;
	for(int j=1,v=m&u;j<m;j<<=1,u>>=1)for(int i=0;i<m;i++)x=o[i],y=1ll*w[v]*o[i+j]%p,o[i]=(x+y)%p,o[i+j]=(p+x-y)%p,(i&j-1)==j-1?i+=j,v=m&u:v+=u;
}
void dfs(int u,int v)
{
	for(int i=a[u];i;i=b[i])if(c[i]!=v)dfs(c[i],u),s[u]+=s[c[i]],l[n-s[c[i]]]++,l[s[c[i]]]++;
}
int main()
{
	scanf("%d",&n),s[n]=1;
	for(int i=1,u,v;i<n;i++)s[i]=1,scanf("%d%d",&u,&v),b[++t]=a[u],c[a[u]=t]=v,b[++t]=a[v],c[a[v]=t]=u;
	dfs(m=1,0),t=0;
	while(m<=n<<1)m<<=1,t++;w[*d=d[1]=*e=e[1]=*w=w[m]=1]=calc(5,p>>t--),f[1]=1<<t;
	for(int i=2;i<m;i++)f[i]=f[i>>1]>>1|(i&1)<<t,w[i]=1ll*w[i-1]*w[1]%p;
	for(int i=2;i<=n;i++)d[i]=1ll*d[i-1]*i%p,e[i]=1ll*(p-p/i)*e[p%i]%p;
	for(int i=2;i<=n;i++)e[i]=1ll*e[i-1]*e[i]%p;
	for(int i=0;i<=n;i++)l[i]=1ll*l[i]*d[i]%p,r[i]=e[n-i];
	NTT(l,m>>1),NTT(r,m>>1);
	for(int i=0;i<m;i++)l[i]=1ll*l[i]*r[i]%p;
	NTT(l,-m>>1),t=calc(m,p-2);
	for(int i=1;i<=n;i++)printf("%lld\n",(1ll*d[n]*e[n-i]%p*e[i]%p*n%p+p-1ll*l[n+i]*t%p*e[i]%p)%p);
	return 0;
}