Tree Coloring

No attempts yetTime limit1sMemory limit128 MB

Problem

A tree is a connected undirected graph with no cycle. You are given a tree with NN nodes and N1N-1 edges. You want to color the tree, that is, give every node one color from {1,2,,K}\{1, 2, \dots, K\} so that two nodes joined by an edge always get different colors.

Write a program that counts how many colorings there are. The count can be very large, so print it modulo 9356393563.

Input

The first line contains the number of test cases TT (1T101 \le T \le 10). Then TT test cases follow, each in this format.

  • The first line of a test case contains two integers NN and KK. NN is the number of nodes (2N2002 \le N \le 200) and KK is the number of colors you may use (1K101 \le K \le 10). The nodes are numbered from 11 to NN.
  • Each of the next N1N-1 lines describes one edge of the tree with two integers AA and BB (1AN1 \le A \le N; 1BN1 \le B \le N; ABA \ne B), meaning an edge joins node AA and node BB.

Output

Print TT lines. For each test case, print the number of colorings modulo 9356393563 on one line, in input order.