I. Marks
time limit per test
1 second
memory limit per test
1024 megabytes
input
standard input
output
standard output

There is a circular track with $$$b$$$ equally spaced positions, numbered $$$0, 1, \dots, b-1$$$ clockwise. Adjacent positions are $$$1$$$ unit apart, so the whole circle measures $$$b$$$ units.

A marker starts at position $$$0$$$ and, at every step, advances by a fixed $$$a$$$ positions clockwise (wrapping back to $$$0$$$ after position $$$b-1$$$). It successively stops at $$$$$$p_k = (a \cdot k) \bmod b, \qquad k = 0, 1, \dots, n-1,$$$$$$ leaving a mark at each stop, for a total of $$$n$$$ marks. It is guaranteed that $$$\gcd(a, b) = 1$$$$$$^{\text{∗}}$$$ and $$$n \leq b$$$, so these $$$n$$$ marks are pairwise distinct.

These $$$n$$$ marks divide the circle into $$$n$$$ arcs. The length of an arc is the number of units it spans (every arc length is a positive integer, and the lengths sum to $$$b$$$).

How many distinct arc-length values are there? For each value, what is it, and how many times does it occur?

$$$^{\text{∗}}$$$$$$\gcd(a, b) = c$$$ means that $$$c$$$ is the largest positive integer such that $$$c$$$ divides both $$$a$$$ and $$$b$$$.

Input

Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$. The description of the test cases follows.

The only line of each test case contains three integers $$$a$$$, $$$b$$$, and $$$n$$$, representing the parameters of this test case.

  • $$$1 \leq t \leq 30$$$
  • $$$1 \leq a \lt b \leq 10^{18}$$$
  • $$$\gcd(a, b) = 1$$$
  • $$$2 \leq n \leq b$$$
Output

For each test case, first output the number of distinct arc-length values, $$$d$$$.

Followed by $$$d$$$ lines, output $$$2$$$ integers $$$s$$$ and $$$c$$$ for each of which, representing that exactly $$$c$$$ arcs have length $$$s$$$.

For each test case, output these lines in increasing order of $$$s$$$.

Example
Input
1
7 12 7
Output
2
1 2
2 5
Note

Explanation for Sample 1

The marks are $$$\{0, 7, 2, 9, 4, 11, 6\}$$$, which, when sorted, are $$$0, 2, 4, 6, 7, 9, 11$$$. The consecutive arc lengths are $$$2, 2, 2, 1, 2, 2, 1$$$, so length $$$1$$$ occurs $$$2$$$ times and length $$$2$$$ occurs $$$5$$$ times.