# Original solution
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    fl = defaultdict(lambda : 0)
    fr = defaultdict(lambda : 0)

    def dfs(x):
        sx = s[x]
        ex = e[x]
        nsx = sx-1
        for y in v[x]:
            if ans[y]:continue
            sy,ey = s[y],e[y]
            if nsx:
                nex = ((ex-1)*sx-ey)/nsx+1
            else:
                nex = 1
            nsy = sy+1
            ney = ((ey-1)*sy+nex)/nsy+1
            ans[y] = ney
            s[x] = nsx
            e[x] = nex
            s[y] = nsy
            e[y] = ney
            dfs(y)
            s[x] = sx
            e[x] = ex
            s[y] = sy
            e[y] = ey

    n = I()
    v = [[] for i in range(n)]
    for i in range(n-1):
        a,b = LI()
        a -= 1
        b -= 1
        v[a].append(b)
        v[b].append(a)
    q = [0]
    q2 = []
    s = [0]*n
    e = [0]*n
    e[0] = 1
    while q:
        x = q.pop()
        for y in v[x]:
            if not e[y]:
                s[x] += 1
                e[y] = 1
                q.append(y)
                q2.append((y,x))

    while q2:
        y,x = q2.pop()
        e[x] += e[y]/s[x]
    ans = [0]*n
    ans[0] = e[0]
    dfs(0)

    for i in ans:
        print((i-1))
    return

#Solve
if __name__ == "__main__":
    solve()


# Optimized solution
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def dfs(x):
        sx = s[x]
        ex = e[x]
        nsx = sx-1
        for y in v[x]:
            if ans[y]:continue
            sy,ey = s[y],e[y]
            if nsx:
                nex = ((ex-1)*sx-ey)/nsx+1
            else:
                nex = 1
            nsy = sy+1
            ney = ((ey-1)*sy+nex)/nsy+1
            ans[y] = ney
            s[x] = nsx
            e[x] = nex
            s[y] = nsy
            e[y] = ney
            dfs(y)
            s[x] = sx
            e[x] = ex
            s[y] = sy
            e[y] = ey

    n = I()
    v = [[] for i in range(n)]
    for i in range(n-1):
        a,b = LI()
        a -= 1
        b -= 1
        v[a].append(b)
        v[b].append(a)
    q = [0]
    q2 = []
    s = [0]*n
    e = [0]*n
    e[0] = 1
    while q:
        x = q.pop()
        for y in v[x]:
            if not e[y]:
                s[x] += 1
                e[y] = 1
                q.append(y)
                q2.append((y,x))

    while q2:
        y,x = q2.pop()
        e[x] += e[y]/s[x]
    ans = [0]*n
    ans[0] = e[0]
    dfs(0)

    for i in ans:
        print((i-1))
    return

#Solve
if __name__ == "__main__":
    solve()