Diameter Two

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

문제

You are building a computer network for a new company. The network consists of nn nodes numbered from 11 to nn. The nodes can be connected via bidirectional wires. Each wire connects exactly two nodes. Each pair of nodes can be connected with at most one wire. If a wire connects two nodes, we'll say that these two nodes are directly connected.

The first kk nodes (with indices 1,2,,k1, 2, \ldots, k) will be untrusted and must be connected to the network securely. Each of these nodes must be directly connected to exactly one other node.

The remaining nkn-k nodes (with indices k+1,k+2,,nk+1, k+2, \ldots, n) will be trusted and must be connected to the network reliably. Each of these nodes must be directly connected to at least two other nodes.

The diameter of the network must not exceed 22: for any two nodes ii and jj, they must either be directly connected, or there must exist a node kk such that nodes ii and kk are directly connected, and nodes kk and jj are directly connected.

To minimize the costs, the number of used wires must be as small as possible.

Build a network satisfying all the conditions above, or report if this is impossible.

입력

Each test contains multiple test cases. The first line contains the number of test cases tt (1t501 \le t \le 50). Description of the test cases follows.

The only line of each test case contains two integers nn and kk, denoting the total number of nodes and the number of untrusted nodes, respectively (3n503 \le n \le 50; 0kn0 \le k \le n).

출력

For each test case, if it is impossible to build a network satisfying the given conditions, print a single integer 1-1.

Otherwise, in the first line, print the number of used wires mm. In each of the following mm lines, print two integers u_iu\_i and v_iv\_i, denoting the indices of the nodes connected with the ii-th wire (1u_i,v_in1 \le u\_i, v\_i \le n; u_iv_iu\_i \ne v\_i).