SP22528 CQM1TREE - Paths in a Tree

Description

Given a tree and a set of edges **K**, find total number of distinct paths in the tree consisting of all the edges in **K**. Two paths are distinct if the end nodes of the paths are different. Also, a path like (1->2->3) is same as (3->2->1). A path is defined as a series of edges which connect a sequence of vertices which are all distinct.

Input Format

First line denotes the number of test cases **T** (

Output Format

For each test case, output a single integer denoting the number of distinct paths in the tree consisting of all the edges in the set.