Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)

mod = 10**9 + 7

## nCkのmodを求める関数
# テーブルを作る(前処理)
max = 2*10**5 + 10
fac, finv, inv = [0]*max, [0]*max, [0]*max

def comInit(max):
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1

    for i in range(2,max):
      fac[i] = fac[i-1]* i% mod
      inv[i] = mod - inv[mod%i] * (mod // i) % mod
      finv[i] = finv[i-1] * inv[i] % mod

comInit(max)

####

n = int(input())
neigh = {}
degree = [0]*(n+1)

neigh[0] = {}
for i in range(1,n+1):
    neigh[i] = {0:[-1,-1]}
    neigh[0][i] = [-1,-1]

for _ in range(n-1):
    a,b = map(int, input().split())
    neigh[a][b] = [-1,-1] # 0:num 1:conb
    neigh[b][a] = [-1,-1]
    degree[a] += 1
    degree[b] += 1

# キュー
from collections import deque

remains = set(range(1,n+1))
stack = deque()
stack2 = deque()
tmp = -1
while(len(remains) > 0):
    for i in remains:
        if(degree[i] == 1):
            tmp = i
            break
    remains.remove(i)

    for i in neigh[i].keys():
        if(i in remains):
            stack.appendleft([i, tmp])
            stack2.append([tmp, i])
            degree[i] -= 1
            degree[tmp] -= 1
            break

while(len(stack2) > 0):
    i,j = stack2.pop()
    stack.appendleft([i,j])

for i in range(1,n+1):
    stack.appendleft([0,i])

while(len(stack) > 0):
    parent, child = stack.pop()
    tmp = neigh[parent][child]
    if(tmp[0] != -1):
        continue

    tmp_0 = neigh[0][child]
    tmp_rev = neigh[child][parent]
    if(tmp_0[0] != -1)&(tmp_rev[0] != -1):
        sum_n = tmp_0[0] - tmp_rev[0]
        sum_conb = tmp_0[1] * fac[tmp_rev[0]] % mod
        sum_conb = sum_conb * finv[tmp_0[0] - 1] % mod
        sum_conb = sum_conb * fac[ tmp_0[0] - 1 - tmp_rev[0]] % mod
        sum_conb = sum_conb * pow(tmp_rev[1] ,mod-2,mod) % mod

        neigh[parent][child] = [sum_n, sum_conb]
        continue

    num = []
    conb = 1
    for j in neigh[child].keys():
        if(j == parent)|(j == 0):
            continue

        next = neigh[child][j]
        num.append(next[0])
        conb =  conb * next[1] % mod

    if(len(num)==0):
        neigh[parent][child] = [1,1]
        continue

    sum_n = sum(num)
    conb_next = conb * fac[sum_n] % mod
    for j in num:
        conb_next = conb_next * finv[j] % mod

    neigh[parent][child] = [sum_n + 1, conb_next]
    if(tmp_rev[0] != -1)&(parent != 0):
        sum_0 = sum_n + tmp_rev[0]
        conb_0 = fac[sum_0] * finv[sum_n] * finv[tmp_rev[0]] % mod
        conb_0 = conb_0 * conb_next * tmp_rev[1] % mod
        neigh[0][child] = [sum_0 + 1, conb_0]

for i in range(1,n+1):
    print(neigh[0][i][1])

Fixed submission:
n = int(input())
mod = 10**9 + 7

## nCkのmodを求める関数
# テーブルを作る(前処理)
max = 2 * 10**5 + 10
fac, finv, inv = [0]*max, [0]*max, [0]*max

def comInit(max):
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1

    for i in range(2,max):
      fac[i] = fac[i-1]* i% mod
      inv[i] = mod - inv[mod%i] * (mod // i) % mod
      finv[i] = finv[i-1] * inv[i] % mod

comInit(max)

# 二項係数の計算
def com(n,k):
    if(n < k):
        return 0
    if( (n<0) | (k < 0)):
        return 0
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod

# 前準備
import sys
input = sys.stdin.readline
from collections import deque

graph = [[] for _ in range(n+1)]
for _ in range(n-1):
    a,b = map(int,input().split())
    graph[a].append(b)
    graph[b].append(a)

def calc(a,b):
    p_a, e_a = a
    p_b, e_b = b
    e = e_a + e_b
    p = p_a * p_b * com(e,e_a) % mod
    return(p,e)

# calc1 の定義
def calc1(c,p):
    p_num, e_num = 1,0
    for i in graph[c]:
        if i == p:
            continue
        p_num,e_num = calc((p_num, e_num) , dp1[i] )
    e_num += 1
    dp1[c] = (p_num, e_num)

# calc2 の定義
def calc2(p):
    arr = [dp1[c] if c != parent[p] else dp2[p] for c in graph[p]]

    left = [(1,0)]
    for i in arr[:-1]:
        left.append( calc(left[-1], i ) )
    right = [(1,0)]
    for i in arr[:0:-1]:
        right.append( calc(right[-1], i) )
    right = right[::-1]

    prod = []
    for a,b in zip(left,right):
        p_tmp,e_tmp = calc(a,b)
        prod.append( (p_tmp, e_tmp) )


    for c,x in zip(graph[p], prod):
        if(c != parent[p]):
            p_tmp,e_tmp = x
            dp2[c] = (p_tmp,e_tmp+1)



# 根から探索して親と探索順を記録
root = 1
order = []
parent = [0] * (n+1)
stack = deque()
stack.append(root)
while stack:
    x = stack.pop()
    order.append(x)
    for y in graph[x]:
        if y == parent[x]:
            continue
        stack.append(y)
        parent[y] = x

# 親→子の値を算出
dp1 = [None] * (n+1)
for i in order[::-1]:
    calc1(i, parent[i])

# 子→親の値を算出　累積和チックにすることでうに対策。
dp2 = [None] * (n+1)
dp2[root] = (1,0)
for i in order:
    calc2(i)

for i in range(1,n+1):
    p1,e1 = dp1[i]
    p2,e2 = dp2[i]
    e1 -= 1
    ans = calc((p1,e1), (p2,e2))[0]
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)

mod = 10**9 + 7

## nCkのmodを求める関数
# テーブルを作る(前処理)
max = 2*10**5 + 10
fac, finv, inv = [0]*max, [0]*max, [0]*max

def comInit(max):
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1

    for i in range(2,max):
      fac[i] = fac[i-1]* i% mod
      inv[i] = mod - inv[mod%i] * (mod // i) % mod
      finv[i] = finv[i-1] * inv[i] % mod

comInit(max)

####

n = int(input())
neigh = {}
degree = [0]*(n+1)

neigh[0] = {}
for i in range(1,n+1):
    neigh[i] = {0:[-1,-1]}
    neigh[0][i] = [-1,-1]

for _ in range(n-1):
    a,b = map(int, input().split())
    neigh[a][b] = [-1,-1] # 0:num 1:conb
    neigh[b][a] = [-1,-1]
    degree[a] += 1
    degree[b] += 1

# キュー
from collections import deque

remains = set(range(1,n+1))
stack = deque()
stack2 = deque()
tmp = -1
while(len(remains) > 0):
    for i in remains:
        if(degree[i] == 1):
            tmp = i
            break
    remains.remove(i)

    for i in neigh[i].keys():
        if(i in remains):
            stack.appendleft([i, tmp])
            stack2.append([tmp, i])
            degree[i] -= 1
            degree[tmp] -= 1
            break

while(len(stack2) > 0):
    i,j = stack2.pop()
    stack.appendleft([i,j])

for i in range(1,n+1):
    stack.appendleft([0,i])

while(len(stack) > 0):
    parent, child = stack.pop()
    tmp = neigh[parent][child]
    if(tmp[0] != -1):
        continue

    tmp_0 = neigh[0][child]
    tmp_rev = neigh[child][parent]
    if(tmp_0[0] != -1)&(tmp_rev[0] != -1):
        sum_n = tmp_0[0] - tmp_rev[0]
        sum_conb = tmp_0[1] * fac[tmp_rev[0]] % mod
        sum_conb = sum_conb * finv[tmp_0[0] - 1] % mod
        sum_conb = sum_conb * fac[ tmp_0[0] - 1 - tmp_rev[0]] % mod
        sum_conb = sum_conb * pow(tmp_rev[1] ,mod-2,mod) % mod

        neigh[parent][child] = [sum_n, sum_conb]
        continue

    num = []
    conb = 1
    for j in neigh[child].keys():
        if(j == parent)|(j == 0):
            continue

        next = neigh[child][j]
        num.append(next[0])
        conb =  conb * next[1] % mod

    if(len(num)==0):
        neigh[parent][child] = [1,1]
        continue

    sum_n = sum(num)
    conb_next = conb * fac[sum_n] % mod
    for j in num:
        conb_next = conb_next * finv[j] % mod

    neigh[parent][child] = [sum_n + 1, conb_next]
    if(tmp_rev[0] != -1)&(parent != 0):
        sum_0 = sum_n + tmp_rev[0]
        conb_0 = fac[sum_0] * finv[sum_n] * finv[tmp_rev[0]] % mod
        conb_0 = conb_0 * conb_next * tmp_rev[1] % mod
        neigh[0][child] = [sum_0 + 1, conb_0]

for i in range(1,n+1):
    print(neigh[0][i][1])

Fixed submission:
n = int(input())
mod = 10**9 + 7

## nCkのmodを求める関数
# テーブルを作る(前処理)
max = 2 * 10**5 + 10
fac, finv, inv = [0]*max, [0]*max, [0]*max

def comInit(max):
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1

    for i in range(2,max):
      fac[i] = fac[i-1]* i% mod
      inv[i] = mod - inv[mod%i] * (mod // i) % mod
      finv[i] = finv[i-1] * inv[i] % mod

comInit(max)

# 二項係数の計算
def com(n,k):
    if(n < k):
        return 0
    if( (n<0) | (k < 0)):
        return 0
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod

# 前準備
import sys
input = sys.stdin.readline
from collections import deque

graph = [[] for _ in range(n+1)]
for _ in range(n-1):
    a,b = map(int,input().split())
    graph[a].append(b)
    graph[b].append(a)

def calc(a,b):
    p_a, e_a = a
    p_b, e_b = b
    e = e_a + e_b
    p = p_a * p_b * com(e,e_a) % mod
    return(p,e)

# calc1 の定義
def calc1(c,p):
    p_num, e_num = 1,0
    for i in graph[c]:
        if i == p:
            continue
        p_num,e_num = calc((p_num, e_num) , dp1[i] )
    e_num += 1
    dp1[c] = (p_num, e_num)

# calc2 の定義
def calc2(p):
    arr = [dp1[c] if c != parent[p] else dp2[p] for c in graph[p]]

    left = [(1,0)]
    for i in arr[:-1]:
        left.append( calc(left[-1], i ) )
    right = [(1,0)]
    for i in arr[:0:-1]:
        right.append( calc(right[-1], i) )
    right = right[::-1]

    prod = []
    for a,b in zip(left,right):
        p_tmp,e_tmp = calc(a,b)
        prod.append( (p_tmp, e_tmp) )


    for c,x in zip(graph[p], prod):
        if(c != parent[p]):
            p_tmp,e_tmp = x
            dp2[c] = (p_tmp,e_tmp+1)



# 根から探索して親と探索順を記録
root = 1
order = []
parent = [0] * (n+1)
stack = deque()
stack.append(root)
while stack:
    x = stack.pop()
    order.append(x)
    for y in graph[x]:
        if y == parent[x]:
            continue
        stack.append(y)
        parent[y] = x

# 親→子の値を算出
dp1 = [None] * (n+1)
for i in order[::-1]:
    calc1(i, parent[i])

# 子→親の値を算出　累積和チックにすることでうに対策。
dp2 = [None] * (n+1)
dp2[root] = (1,0)
for i in order:
    calc2(i)

for i in range(1,n+1):
    p1,e1 = dp1[i]
    p2,e2 = dp2[i]
    e1 -= 1
    ans = calc((p1,e1), (p2,e2))[0]
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)

mod = 10**9 + 7

## nCkのmodを求める関数
# テーブルを作る(前処理)
max = 2*10**5 + 10
fac, finv, inv = [0]*max, [0]*max, [0]*max

def comInit(max):
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1

    for i in range(2,max):
      fac[i] = fac[i-1]* i% mod
      inv[i] = mod - inv[mod%i] * (mod // i) % mod
      finv[i] = finv[i-1] * inv[i] % mod

comInit(max)

####

n = int(input())
neigh = {}
degree = [0]*(n+1)

neigh[0] = {}
for i in range(1,n+1):
    neigh[i] = {0:[-1,-1]}
    neigh[0][i] = [-1,-1]

for _ in range(n-1):
    a,b = map(int, input().split())
    neigh[a][b] = [-1,-1] # 0:num 1:conb
    neigh[b][a] = [-1,-1]
    degree[a] += 1
    degree[b] += 1

# キュー
from collections import deque

for i in range(1,n+1):
    stack = deque()
    check = deque()
    check.append([0,i])
    while(len(check) > 0):
        tmp = check.pop()
        stack.append(tmp)
        for j in neigh[tmp[1]].keys():
            if(j!=0)&(j!=tmp[0]):
                check.append([ tmp[1] , j])

    while(len(stack) > 0):
        parent, child = stack.pop()
        tmp = neigh[parent][child]
        if(tmp[0] != -1):
            continue

        tmp_0 = neigh[0][child]
        tmp_rev = neigh[child][parent]
        if(tmp_0[0] != -1)&(tmp_rev[0] != -1):
            sum_n = tmp_0[0] - tmp_rev[0]
            sum_conb = tmp_0[1] * fac[tmp_rev[0]] % mod
            sum_conb = sum_conb * finv[tmp_0[0] - 1] % mod
            sum_conb = sum_conb * fac[ tmp_0[0] - 1 - tmp_rev[0]] % mod
            sum_conb = sum_conb * pow(tmp_rev[1] ,mod-2,mod) % mod

            neigh[parent][child] = [sum_n, sum_conb]
            continue

        num = []
        conb = 1
        for j in neigh[child].keys():
            if(j == parent)|(j == 0):
                continue

            next = neigh[child][j]
            num.append(next[0])
            conb =  conb * next[1] % mod

        if(len(num)==0):
            neigh[parent][child] = [1,1]
            continue

        sum_n = sum(num)
        conb_next = conb * fac[sum_n] % mod
        for j in num:
            conb_next = conb_next * finv[j] % mod

        neigh[parent][child] = [sum_n + 1, conb_next]
        if(tmp_rev[0] != -1)&(parent != 0):
            sum_0 = sum_n + tmp_rev[0]
            conb_0 = fac[sum_0] * finv[sum_n] * finv[tmp_rev[0]] % mod
            conb_0 = conb_0 * conb_next * tmp_rev[1] % mod
            neigh[0][child] = [sum_0 + 1, conb_0]

    print(neigh[0][i][1])

Fixed submission:
n = int(input())
mod = 10**9 + 7

## nCkのmodを求める関数
# テーブルを作る(前処理)
max = 2 * 10**5 + 10
fac, finv, inv = [0]*max, [0]*max, [0]*max

def comInit(max):
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1

    for i in range(2,max):
      fac[i] = fac[i-1]* i% mod
      inv[i] = mod - inv[mod%i] * (mod // i) % mod
      finv[i] = finv[i-1] * inv[i] % mod

comInit(max)

# 二項係数の計算
def com(n,k):
    if(n < k):
        return 0
    if( (n<0) | (k < 0)):
        return 0
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod

# 前準備
import sys
input = sys.stdin.readline
from collections import deque

graph = [[] for _ in range(n+1)]
for _ in range(n-1):
    a,b = map(int,input().split())
    graph[a].append(b)
    graph[b].append(a)

def calc(a,b):
    p_a, e_a = a
    p_b, e_b = b
    e = e_a + e_b
    p = p_a * p_b * com(e,e_a) % mod
    return(p,e)

# calc1 の定義
def calc1(c,p):
    p_num, e_num = 1,0
    for i in graph[c]:
        if i == p:
            continue
        p_num,e_num = calc((p_num, e_num) , dp1[i] )
    e_num += 1
    dp1[c] = (p_num, e_num)

# calc2 の定義
def calc2(p):
    arr = [dp1[c] if c != parent[p] else dp2[p] for c in graph[p]]

    left = [(1,0)]
    for i in arr[:-1]:
        left.append( calc(left[-1], i ) )
    right = [(1,0)]
    for i in arr[:0:-1]:
        right.append( calc(right[-1], i) )
    right = right[::-1]

    prod = []
    for a,b in zip(left,right):
        p_tmp,e_tmp = calc(a,b)
        prod.append( (p_tmp, e_tmp) )


    for c,x in zip(graph[p], prod):
        if(c != parent[p]):
            p_tmp,e_tmp = x
            dp2[c] = (p_tmp,e_tmp+1)



# 根から探索して親と探索順を記録
root = 1
order = []
parent = [0] * (n+1)
stack = deque()
stack.append(root)
while stack:
    x = stack.pop()
    order.append(x)
    for y in graph[x]:
        if y == parent[x]:
            continue
        stack.append(y)
        parent[y] = x

# 親→子の値を算出
dp1 = [None] * (n+1)
for i in order[::-1]:
    calc1(i, parent[i])

# 子→親の値を算出　累積和チックにすることでうに対策。
dp2 = [None] * (n+1)
dp2[root] = (1,0)
for i in order:
    calc2(i)

for i in range(1,n+1):
    p1,e1 = dp1[i]
    p2,e2 = dp2[i]
    e1 -= 1
    ans = calc((p1,e1), (p2,e2))[0]
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)

mod = 10**9 + 7

## nCkのmodを求める関数
# テーブルを作る(前処理)
max = 2*10**5 + 10
fac, finv, inv = [0]*max, [0]*max, [0]*max

def comInit(max):
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1

    for i in range(2,max):
      fac[i] = fac[i-1]* i% mod
      inv[i] = mod - inv[mod%i] * (mod // i) % mod
      finv[i] = finv[i-1] * inv[i] % mod

comInit(max)

# 二項係数の計算
def com(n,k):
    if(n < k):
        return 0
    if( (n<0) | (k < 0)):
        return 0
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod

####

n = int(input())
neigh = {}
degree = [0]*(n+1)

neigh[0] = {}
for i in range(1,n+1):
    neigh[i] = {0:[-1,-1]}
    neigh[0][i] = [-1,-1]

for _ in range(n-1):
    a,b = map(int, input().split())
    neigh[a][b] = [-1,-1] # 0:num 1:conb
    neigh[b][a] = [-1,-1]
    degree[a] += 1
    degree[b] += 1

def calc(parent,child):
    tmp = neigh[parent][child]
    if(tmp[0] != -1):
        return tmp[::]

    tmp_0 = neigh[0][child]
    tmp_rev = neigh[child][parent]
    if(tmp_0[0] != -1)&(tmp_rev[0] != -1):
        # print('hoge2')
        sum_n = tmp_0[0] - tmp_rev[0]
        sum_conb = tmp_0[1] * fac[tmp_rev[0]] % mod
        sum_conb = sum_conb * finv[tmp_0[0] - 1] % mod
        sum_conb = sum_conb * fac[ tmp_0[0] - 1 - tmp_rev[0]] % mod
        sum_conb = sum_conb * pow(tmp_rev[1] ,mod-2,mod) % mod

        neigh[parent][child] = [sum_n, sum_conb]
        return [sum_n, sum_conb]

    num = []
    conb = 1
    for i in neigh[child].keys():
        if(i == parent)|(i == 0):
            continue

        next = calc(child, i)
        num.append(next[0])
        conb =  conb * next[1] % mod


    if(len(num)==0):
        # print('hoge0')
        neigh[parent][child] = [1,1]
        return [1,1]

    sum_n = sum(num)
    conb_next = conb * fac[sum_n] % mod
    for i in num:
        conb_next = conb_next * finv[i] % mod

    neigh[parent][child] = [sum_n + 1, conb_next]
    if(tmp_rev[0] != -1)&(parent != 0):
        # print('hoge3 {} {}'.format(parent, child))
        sum_0 = sum_n + tmp_rev[0]
        conb_0 = fac[sum_0] * finv[sum_n] * finv[tmp_rev[0]] % mod
        conb_0 = conb_0 * conb_next * tmp_rev[1] % mod
        neigh[0][child] = [sum_0 + 1, conb_0]
        # print([sum_0 + 1, conb_0])

    # print('hoge {} {}'.format(parent, child))
    # print(neigh[parent][child][::])
    return neigh[parent][child][::]

for i in range(1,n+1):
    for j in neigh[i].keys():
        if(j != 0):
            # print('ij {} {}'.format(i,j))
            # print(calc(i,j))
            calc(i,j)
    calc(0,i)
    print(neigh[0][i][1])

Fixed submission:
n = int(input())
mod = 10**9 + 7

## nCkのmodを求める関数
# テーブルを作る(前処理)
max = 2 * 10**5 + 10
fac, finv, inv = [0]*max, [0]*max, [0]*max

def comInit(max):
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1

    for i in range(2,max):
      fac[i] = fac[i-1]* i% mod
      inv[i] = mod - inv[mod%i] * (mod // i) % mod
      finv[i] = finv[i-1] * inv[i] % mod

comInit(max)

# 二項係数の計算
def com(n,k):
    if(n < k):
        return 0
    if( (n<0) | (k < 0)):
        return 0
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod

# 前準備
import sys
input = sys.stdin.readline
from collections import deque

graph = [[] for _ in range(n+1)]
for _ in range(n-1):
    a,b = map(int,input().split())
    graph[a].append(b)
    graph[b].append(a)

def calc(a,b):
    p_a, e_a = a
    p_b, e_b = b
    e = e_a + e_b
    p = p_a * p_b * com(e,e_a) % mod
    return(p,e)

# calc1 の定義
def calc1(c,p):
    p_num, e_num = 1,0
    for i in graph[c]:
        if i == p:
            continue
        p_num,e_num = calc((p_num, e_num) , dp1[i] )
    e_num += 1
    dp1[c] = (p_num, e_num)

# calc2 の定義
def calc2(p):
    arr = [dp1[c] if c != parent[p] else dp2[p] for c in graph[p]]

    left = [(1,0)]
    for i in arr[:-1]:
        left.append( calc(left[-1], i ) )
    right = [(1,0)]
    for i in arr[:0:-1]:
        right.append( calc(right[-1], i) )
    right = right[::-1]

    prod = []
    for a,b in zip(left,right):
        p_tmp,e_tmp = calc(a,b)
        prod.append( (p_tmp, e_tmp) )


    for c,x in zip(graph[p], prod):
        if(c != parent[p]):
            p_tmp,e_tmp = x
            dp2[c] = (p_tmp,e_tmp+1)



# 根から探索して親と探索順を記録
root = 1
order = []
parent = [0] * (n+1)
stack = deque()
stack.append(root)
while stack:
    x = stack.pop()
    order.append(x)
    for y in graph[x]:
        if y == parent[x]:
            continue
        stack.append(y)
        parent[y] = x

# 親→子の値を算出
dp1 = [None] * (n+1)
for i in order[::-1]:
    calc1(i, parent[i])

# 子→親の値を算出　累積和チックにすることでうに対策。
dp2 = [None] * (n+1)
dp2[root] = (1,0)
for i in order:
    calc2(i)

for i in range(1,n+1):
    p1,e1 = dp1[i]
    p2,e2 = dp2[i]
    e1 -= 1
    ans = calc((p1,e1), (p2,e2))[0]
    print(ans)