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++14 (GCC 5.4.1) (judge verdict: Runtime Error)

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
const int mod = 1000000007;
ll modpow(ll a, int b) { return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }



void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}


// https://ei1333.hateblo.jp/entry/2017/04/10/224413
// ある頂点を根としたものを構成
// すべての頂点を根としたものを構成
struct edge { int to, cost; };
int n;
const int maxn = 100005;
vector<edge> G[maxn];
double E[maxn];
vector<double> ans(maxn);

void dfs(int v, int p) {
  double E2 = 0;
  int cnt = 0;
  for (edge& e : G[v]) {
    if (e.to == p) continue;
    dfs(e.to, v);
    // dfs から上がってきたタイミングで
    E2 += E[e.to] + 1;
    cnt++;
  }
  if (cnt) E[v] = E2 / cnt;
}

// v を根とする答え
void dfs2(int v, double Epar, int p) {
  double ret = 0;
  for (edge& e : G[v]) {
    // 親との距離と, 親方向の部分木で一番遠い頂点との距離の和
    if (e.to == p) ret += Epar + e.cost;
    // 部分木の, ある頂点 j への距離と, j と j の部分木内での一番遠い頂点との距離の和
    else ret += e.cost + E[e.to], e.to;
  }
  ans[v] = ret / sz(G[v]);

  for (edge& e : G[v]) {
    if (e.to == p) continue;
    dfs2(e.to, sz(G[v]) == 1 ? 0 : (ret - (E[e.to] + 1)) / (sz(G[v]) - 1), v);
    // sz(G[v]) == 1, 葉
    // 0 = 0/1

  }
}

void solve() {
  cin >> n;
  rep(i, n - 1) {
    int a, b;
    cin >> a >> b;
    a--; b--; // debuged
    G[a].eb(edge{b, 1});
    G[b].eb(edge{a, 1});
  }
  dfs(0, -1);
  rep(i, n) cout << E[i] << " "; cout << endl;
  dfs2(0, 0, -1);
  rep(i, n) cout << ans[i] << endl;
}