The first line contains two integers N and K, the number of barns on the farm and the number of barns that are already painted (0≤K≤N).
Each of the next N−1 lines contains two integers x and y, describing a path that directly connects barn x and barn y (1≤x,y≤N, x=y).
Each of the next K lines contains two integers b and c, meaning that barn b is painted with color c (1≤b≤N, 1≤c≤3). No barn number appears more than once in these lines.