Light Heavy Edges

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

There is a tree with nn vertices. An edge of the tree may be either a light edge or a heavy edge. You need to perform mm operations on the tree. Initially, all edges on the tree are light edges. There are two operations:

  1. Given two vertices aa and bb, for all xx on the path between aa and bb (including aa and bb themselves), you need to turn all edges connected with xx into light edges, and turn all edges on the path between aa and bb into heavy edges.

  2. Given two vertices aa and bb, you need to compute the number of heavy edges on the path between aa and bb.

입력

The first line is an integer TT denoting the number of test cases. For each test case, the first line has two integers nn and mm where nn is the number of vertices and mm is the number of operations.

For the next n1n-1 lines, each line contains two integers uu and vv denoting an edge of the tree.

For the next mm lines, each line contains three integers op_i,a_i,b_iop\_i,a\_i,b\_i denoting an operation. op_i=1op\_i = 1 means the operation is an operation of the first type, while op_i=2op\_i = 2 means the operation is an operation of the second type.

It's guaranteed that a_ib_ia\_i \ne b\_i in all operations.

출력

For each operation of the second type, output an integer denoting the answer to the query.

제한

For all test sets, T3T \le 3, 1n,m1051 \le n,m \le 10^5.