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 Rust (1.15.1) (judge verdict: Wrong Answer)

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::Read;
#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok().unwrap();
    ret
}
fn get_word() -> String {
    let mut stdin = std::io::stdin();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.unwrap_or(0) == 0 || u8b[0] <= b' ' {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { get_word().parse().ok().unwrap() }

fn dfs1(v: usize, par: Option<usize>, edges: &[Vec<usize>],
        dp: &mut [Vec<f64>]) -> f64 {
    let mut tot = 0.0;
    let mut trail = 0.0;
    for i in 0 .. edges[v].len() {
        let w = edges[v][i];
        if Some(w) == par { continue; }
        let res = dfs1(w, Some(v), edges, dp);
        tot += res;
        dp[v][i] = res + 1.0;
        trail += 1.0;
    }
    if trail != 0.0 {
        tot / trail + 1.0
    } else {
        0.0
    }
}
fn dfs2(v: usize, par: Option<usize>, edges: &[Vec<usize>],
        dp: &mut [Vec<f64>], promise: f64) {
    let mut tot = 0.0;
    let mut trail = 0.0;
    for i in 0 .. edges[v].len() {
        let w = edges[v][i];
        if Some(w) == par {
            dp[v][i] = promise;
            tot += promise;
        } else {
            tot += dp[v][i];
            trail += 1.0;
        }
    }
    for i in 0 .. edges[v].len() {
        let w = edges[v][i];
        if Some(w) == par { continue; }
        let tmp = tot - dp[v][i];
        dfs2(w, Some(v), edges, dp, tmp / trail + 1.0);
    }
}


fn solve() {
    let n = get();
    let mut edges = vec![Vec::new(); n];
    for _ in 0 .. n - 1 {
        let u = get::<usize>() - 1;
        let v = get::<usize>() - 1;
        edges[u].push(v);
        edges[v].push(u);
    }
    let mut dp = vec![Vec::new(); n];
    for i in 0 .. n {
        dp[i] = vec![-1.0 / 0.0; edges[i].len()];
    }
    dfs1(0, None, &edges, &mut dp);
    dfs2(0, None, &edges, &mut dp, 0.0 / 0.0);
    for i in 0 .. n {
        let mut tot = 0.0;
        for &val in dp[i].iter() {
            tot += val;
        }
        println!("{}", tot / edges[i].len() as f64);
    }
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}