Given three integers N, M, K, please construct a simple graph G with the following conditions:
There are multiple test cases.
For each test case, there is only one line giving 3 integers N, M, K
(2<=N<=500, 0<=M<=10000, 1<=K<=N).
If there isn't a valid structure, output "Invalid". Otherwise, you need to output all the M edges in M lines. An edge is a pair "A B" meaning an edge between vertex A and vertex B. If there are more than one solution, output the lexicographically smallest one.
Print a blank line after each testcase.
7 6 3 6 6 3 4 3 3
0 1 0 2 0 3 1 4 2 5 3 6 Invalid 0 1 0 2 0 3
Migrated from old NTUJ.
Bee
No. | Testdata Range | Score |
---|