- محدودیت زمان: ۱ ثانیه
- محدودیت حافظه: ۲۵۶ مگابایت
We have a city with n apartments labeled with postal codes 1 to n. The
i−th road in this city, connects apartments ai and bi. Consider delivering food orders to each apartment in the city in the following manner:
For each k=1,2,...,n, Snapp Food wants to solve the following problem:
- First, deliver order 1 to apartment k.
- Then, for each of the food orders 2,…,n in this sequence, deliver the order to the apartment chosen as follows:
Choose an apartment that still does not have an order delivered to it and is adjacent to an apartment with an order already delivered to it. If there are multiple such apartments, choose one of them at random.
Find the number of ways in which we can deliver orders to the apartments, modulo 109+7
The first line of the input is the number of apartments n. The following n lines, each define a road from apartment ai to bi.
2≤n≤200000
1≤ai,bi≤n
output🔗
For each k=1,2,...,n in this sequence, print a line containing the answer to the problem.
example🔗
sample output 1🔗
sample output 2🔗