You have been appointed as the designer for your school's computer network.
In total, there are N computers in the class, and M computer-to-computer connections need to be made. Also, there are three mandatory conditions the design should fulfill.
The first requirement is that any computer in the network should be able to communicate with any other computer through the connections, possibly, through some other computers.
Network attacks are possible, so the second requirement is that even if any one computer from the network gets disabled so that the rest of the computers are unable to communicate with it, the rest of the computers can still communicate with each other. In other words, the first requirement still holds for any subset of (N-1) computers.
The third requirement is that there shouldn't be any irrelevant connections in the network. We will call a connection irrelevant if and only if after its' removal, the above two requirements are still held.
Given N, M, please build a network with N computers and M connections, or state that it is impossible.
-----Input-----
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
The first and only line of each test case contains a pair of space-separated integers N and M denoting the number of computers and the number of connections.
-----Output-----
Output T blocks.
If it is impossible to construct a network with the given parameters for the corresponding test case, output just -1 -1. Otherwise, output M lines, each of which contains a space-separated pairs of integers denoting the IDs of the computers that should be connected. Note that multiple connections between any pair of computers and connections connecting a computer to itself are implicitly not allowed due to the third requirement.
-----Constraints-----
- 1 ≤ T ≤ 1000
- 1 ≤ M ≤ N * (N - 1) / 2
- 1 ≤ Sum of all N ≤ 1000
- Subtask 1 (21 point): 1 ≤ N ≤ 4
- Subtask 2 (79 points): 1 ≤ N ≤ 100
-----Example-----
Input:2
10 1
5 5
Output:-1 -1
1 2
2 3
3 4
4 5
5 1
-----Explanation-----
Example case 1. There are not enough connections even to satisfy the first requirement.
Example case 2. The obtained network satisfies all the requirements.
t = int(input())
for _ in range(0,t):
 n,m = input().split()
 n,m = int(n),int(m)
 if m!=n:
  print("-1 -1")
 else:
  for i in range(0,n):
   if i+2<=n : print(i+1,i+2)
   else : print(i+1,"1")

t = int(input())
for _ in range(0,t):
 n,m = input().split()
 n,m = int(n),int(m)
 if m!=n:
  print("-1 -1")
 else:
  for i in range(0,n):
   if i+2<=n : print(i+1,i+2)
   else : print(i+1,"1")
