P17726 [HackerEarth] Fredo has crush on a girl in his class. He went to ask her out for a date. She, being a coder, gave her a simple graph with N vertices and M edges and asked him to solve a problem on the
普及
题目描述

Fredo has crush on a girl in his class. He went to ask her out for a date. She, being a coder, gave her a simple graph with N vertices and M edges and asked him to solve a problem on the graph in order to go on a date with her.
The problem says:
Let there be some functions defined below:
For each vertex in the graph:
S = max (sum of all vertices lying in the maximum length simple path ending at that vertex)
That is, if there are two simple paths with length 3 ending at some vertex and there can be no simple path with length greater than 3, and P be the sum of vertices of first path and Q of second. So, S = max(P,Q).
Let A = minimum value of S[i] (1 ≤ i ≤ n)
B = maximum value of S[i] (1 ≤ i ≤ n)
You are given an equation Ax = By
Find the minimum value of x and y satisfying the equation.
Note: If there are no simple paths ending at some vertex, S for that vertex will be number of that vertex.
A simple path is a path in a graph which does not have repeating vertices.

Input Format:

First line contains an integer T denoting the number of test cases.
First line of each test case consists of two space separated integers denoting N and M and the following M lines consist of two space separated integers X and Y denoting there is an edge between vertices X and Y.

Output Format:

For each test case, print the values of x and y (space separated) in a separate line.

Constraints:
1 ≤ T ≤ 10
1 ≤ N ≤ 15
0 ≤ M < N*(N-1)/2
1 ≤ X, Y ≤ N

SAMPLE INPUT
2
3 0
3 2
1 2
2 3

SAMPLE OUTPUT
3 1
6 5

Explanation

In the first case, there are no simple paths ending at any vertex, so S={1,2,3}, we need to solve for 1 * x=3 * y.
In the second case,
paths ending at 1 are: 3-2-1 and 2-1. The maximum length path is 3-2-1 having sum=3+2+1=6
paths ending at 2 are: 1-2 and 3-2. Both have the same length, s[2]=max(1+2,3+2)=5
and similarly for 3, s[3]=6
so we need to solve for 5 * x=6 * y.

输入格式

见题面

输出格式

见题面

样例输入
10 15 45 10 6 11 8 3 12 12 7 12 13 15 3 10 1 13 5 8 13 14 11 13 3 11 2 14 2 5 15 9 7 12 11 7 2 5 10 6 11 5 2 13 10 7 11 14 5 14 9 13 4 4 10 8 15 6 3 6 2 12 4 8 9 3 9 15 9 12 14 13 1 4 8 2 3 15 7 1 5 9 6 6 13 9 10 1 8 12 2 12 8 15 1 9 6 15 28 6 13 6 7 1 12 5 8 1 14 5 14 11 13 8 3 12 2 6 14 5 2 2 15 2 10 5 12 8 2 9 6 8 10 10 13 8 12 8 11 4 12 5 4 12 6 11 6 2 7 1 10 3 5 12 10 15 36 14 6 3 8 12 9 5 11 4 8 7 15 4 11 5 14 1 4 5 9 10 12 3 13 12 5 2 9 7 1 15 12 13 9 4 10 9 15 6 1 1 13 4 12 6 13 10 5 12 3 3 11 12 2 2 5 9 8 8 5 10 13 2 15 14 7 4 7 7 5 3 10 15 37 4 2 10 9 2 6 2 10 14 11 2 7 7 12 2 3 11 5 9 4 3 1 3 6 2 12 7 10 10 8 11 12 2 9 14 4 7 6 8 11 14 10 14 9 6 14 3 15 7 11 10 15 15 8 1 9 12 9 3 10 12 10 7 3 5 9 9 13 9 11 15 2 13 1 15 56 12 14 10 8 7 5 9 3 6 1 12 1 7 2 9 14 11 2 11 4 13 11 11 1 13 3 15 9 1 2 8 14 11 14 7 11 12 9 4 15 13 15 6 10 10 5 11 5 5 15 15 7 13 7 6 3 14 7 12 15 2 9 4 5 15 8 5 12 1 4 10 1 1 9 9 11 3 12 2 10 7 4 14 1 4 14 3 15 6 9 15 6 12 6 10 7 7 9 10 9 5 6 11 8 14 3 8 13 2 3 12 11 15 61 3 8 2 10 10 9 1 9 5 6 7 15 14 11 11 6 7 1 14 9 11 3 10 13 2 3 11 1 5 3 12 4 2 7 9 3 15 1 10 5 1 5 14 7 10 6 10 12 12 14 14 10 15 11 13 11 10 15 7 3 9 12 10 1 11 4 7 12 9 4 8 14 13 7 10 8 1 4 7 9 4 13 11 2 12 1 1 3 4 15 10 11 14 1 2 9 10 7 13 6 3 14 8 13 6 3 14 4 5 15 1 6 4 6 15 13 8 2 11 8 4 3 15 86 5 13 15 10 15 2 2 5 6 3 5 10 10 12 7 10 15 1 4 10 13 3 7 5 11 9 5 6 3 1 9 7 13 9 9 5 1 7 4 12 8 5 15 7 14 15 7 2 4 8 1 6 1 12 11 4 12 5 11 6 3 4 11 2 4 7 1 11 9 1 13 2 13 1 10 8 11 13 9 2 11 7 1 5 15 3 14 9 8 9 6 8 3 2 14 3 10 11 13 8 3 5 8 15 10 9 3 9 4 1 6 9 8 14 2 8 11 15 1 10 15 12 8 11 7 14 2 14 13 15 4 5 13 10 3 8 9 12 2 4 5 15 12 2 11 14 4 14 12 14 2 1 3 11 4 6 1 8 10 3 10 6 6 2 12 13 2 10 11 5 12 8 15 70 14 12 12 1 4 3 12 5 9 1 12 15 11 2 4 13 7 11 6 1 1 10 5 13 11 8 12 6 10 11 3 6 11 13 8 14 7 13 8 13 11 3 7 4 5 8 13 1 6 15 8 9 5 2 11 14 12 4 15 10 8 7 14 10 9 5 15 7 11 12 6 10 5 10 11 1 9 10 9 13 12 8 4 11 15 13 4 9 4 6 13 3 15 3 6 7 3 12 10 2 5 3 14 1 3 2 3 9 7 9 2 8 9 12 6 9 5 11 7 14 7 12 13 14 6 5 11 9 5 15 4 2 8 10 6 11 12 10 1 15 15 5 5 1 7 6 2 5 4 11 15 3
样例输出
1 1 15 1 113 98 1 1 1 1 1 1 1 1 1 1 1 1 18 7