Problem:
Max Score: $800$ Points

Problem Statement

There is an undirected connected graph with $N$ vertices and $N-1$ edges. The i-th edge connects u_i and v_i.

E869120 the coder moves in the graph as follows:

He move to adjacent vertex, but he can't a visit vertex two or more times.

He ends move when there is no way to move.

Otherwise, he moves randomly. (equal probability) If he has $p$ way to move this turn, he choose each vertex with $1/p$ probability.

Calculate the expected value of the number of turns, when E869120 starts from vertex i, for all i (1 ≤ i ≤ N).

Input

The input is given from standard input in the following format.

N
u_1 v_1
u_2 v_2
:
u_{N-1} v_{N-1}

Output

In i-th (1 ≤ i ≤ N) line, print the expected vaule of the number of turns E869120 moves.

The relative error or absolute error of output should be within 10^{-6}.

Constraints

$1 \le N \le 150,000$

The graph is connected.

Subtasks

Subtask 1 [ $190$ points ]

There is no vertex which degree is more than 2.

This means the graph looks like a list.

Subtask 2 [ $220$ points ]

1 ≤ N ≤ 1000.

Subtask 3 [ $390$ points ]

There are no additional constraints.

Sample Input 1

4
1 2
2 3
2 4

Sample Output 1

2.0
1.0
2.0
2.0

Sample Input 2

4
1 2
2 4
4 3

Solution in C# (Mono 4.6.2.0) (judge verdict: Time Limit Exceeded)

using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            var N = Sarray()[0];
            grf = new int[N].Select(_ => new List<long>()).ToArray();
            for (var i = 0; i < N - 1; ++i) 
            {
                var stw = Sarray();
                --stw[0];--stw[1];
                grf[stw[0]].Add(stw[1]);
                grf[stw[1]].Add(stw[0]);
            }
            dptree = new double[N];
            prob = 1.0d / N;

            dfs(0, -1);
            dp = new double[N];
            maxdfs(0, 0, 0);
            for (var i = 0; i < N; ++i)
                WriteLine(dp[i]);
        }
        static List<long>[] grf;
        static double[] dptree;
        static double[] dp;
        static double prob;
        static void dfs(long n, long p)
        {
            double deno = 0.0;
            if (0 <= p)
                deno = prob * (grf[n].Count - 1);
            else
                deno = prob * grf[n].Count;
            if (deno <= 0) return;
            double nume = 0.0;
            foreach (var next in grf[n])
            {
                if (next == p) continue;
                dfs(next, n);
                nume += dptree[next];
            }
            dptree[n] = prob * nume / deno + 1.0;
        }
        static void maxdfs(long n, long p, double pinfo)
        {
            double deno = prob * grf[n].Count;
            double nume = 0.0;
            foreach (var next in grf[n])
            {
                if (next == p)
                {
                    nume += pinfo;
                    continue;
                }
                nume += dptree[next];
            }
            dp[n] = prob * nume / deno + 1.0;
            foreach (var next in grf[n])
            {
                if (next == p) continue;
                if (grf[n].Count == 1)
                    maxdfs(next, n, 0);
                else
                    maxdfs(next, n, prob * (nume - dptree[next]) / (deno - prob) + 1);
            }
        }
    }
}