import sys
r = sys.stdin.readline
N, Q = map(int, r().split())
g = []
for _ in range(N - 1):
    p, q, r = map(int, r().split())
    p, q = min(p, q), max(p, q)
    g.append((p, q, r))
for _ in range(Q):
    k, v = map(int, r().split())

0466e535cbc0734428dc3f3e49b5bdd6c697d042
<mask token>

<mask token>
for _ in range(N - 1):
    p, q, r = map(int, r().split())
    p, q = min(p, q), max(p, q)
    g.append((p, q, r))
for _ in range(Q):
    k, v = map(int, r().split())

<mask token>
r = sys.stdin.readline
N, Q = map(int, r().split())
g = []
for _ in range(N - 1):
    p, q, r = map(int, r().split())
    p, q = min(p, q), max(p, q)
    g.append((p, q, r))
for _ in range(Q):
    k, v = map(int, r().split())

import sys
r = sys.stdin.readline
N, Q = map(int, r().split())
g = []
for _ in range(N - 1):
    p, q, r = map(int, r().split())
    p, q = min(p, q), max(p, q)
    g.append((p, q, r))
for _ in range(Q):
    k, v = map(int, r().split())
