Under construction

Still being built. Things may change

Line Graphs

Time limit5sMemory limit512 MB

Summary
Given a simple graph G and k, find the size of a maximum clique in the k-th iterated line graph L_k(G) and count such cliques modulo 1000000007.
Level

Hard9 of 10

Topics
Graph, Combinatorics, Math
Solved
No attempts yet

Problem

Last year, Rounddog participated in a contest with a pretty hard problem set and failed in solving the problem about line graphs. So recently he decided to study them deeper.

In the mathematical discipline of graph theory, the line graph of a simple undirected graph GG is another simple undirected graph L(G)L(G) that represents the adjacency between every two edges in GG. Precisely speaking, for an undirected graph GG without loops or multiple edges, its line graph L(G)L(G) is a graph such that

  • each vertex of L(G)L(G) represents an edge of GG; and
  • two vertices of L(G)L(G) are adjacent if and only if their corresponding edges share a common endpoint in GG.

Given a simple undirected graph GG, Rounddog's study aims to find the maximum cliques in its line graph L(G)L(G), and he decided to turn some of his findings into a challenge for you.

In this problem, you are given a simple undirected graph GG and a small positive integer kk. After finding all maximum cliques in Lk(G)L_k(G), where L0(G)=GL_0(G) = G and Ls(G)=L(Ls−1(G))L_s(G) = L(L_{s-1}(G)) for each positive integer ss, you need to tell Rounddog the number of vertices in a maximum clique in Lk(G)L_k(G), and also the number of distinct maximum cliques modulo 1 000 000 007.

Here, a subset of vertices of an undirected graph is called a clique if and only if there is an edge between each pair of vertices in the subset, and a maximum clique is a clique with the largest possible number of vertices.

Input

The input contains several test cases, and the first line contains a single integer TT (1≤T≤10001 \le T \le 1000), the number of test cases.

For each test case, the first line contains three integers nn (1≤n≤100 0001 \le n \le 100\,000), mm (0≤m≤200 0000 \le m \le 200\,000) and kk (1≤k≤41 \le k \le 4): the number of vertices and edges in the given simple undirected graph GG and the number of iterations of the line graph operation.

Then mm lines follow, describing all edges of the graph. Each of them contains two integers uu and vv (1≤u,v≤n1 \le u, v \le n, u≠vu \ne v), representing an edge between vertices uu and vv.

It is guaranteed that the sum of nn in all test cases does not exceed 2 000 000, the sum of mm does not exceed 3 000 000, and the graph in each test case contains no loops and no multiple edges.

Output

For each test case, output a single line with two integers: first the number of vertices in a maximum clique, and then the number of distinct maximum cliques modulo 1 000 000 007.

Examples1

  1. Example 1

    Input
    3
    5 0 4
    5 4 1
    1 2
    1 3
    1 4
    1 5
    5 4 4
    1 2
    1 3
    1 4
    1 5
    
    Expected output
    0 1
    4 1
    6 12