시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB3110930.000%

문제

You are given a directed graph of $n$ vertices numbered from $0$ to $n - 1$. You are also given two integers $p$ and $q$ such that $1 \leq p, q \leq n$.

The edges of the graph are constructed as follows: for every vertex $i$,

  • if $i + p < n$, then there is an edge from $i$ to $i + p$;
  • if $i - q \geq 0$, then there is an edge from $i$ to $i - q$.

Obviously, the graph has exactly $(n - p) + (n - q)$ edges.

Find any Hamiltonian path in this graph, or determine that it does not exist.

Recall that a Hamiltonian path is a path that visits every vertex exactly once.

입력

The first line of input contains an integer $T$ ($1 \leq T \leq 10^4$), the number of test cases.

Each test case consists of a single line containing three integers: $n$, $p$, and $q$ ($1 \leq p, q \leq n \leq 10^6$).

It is guaranteed that the sum of $n$ over all test cases does not exceed $10^6$.

출력

For each test case, print a single line containing $n$ integers that represent the order of vertices in a Hamiltonian path, or print $-1$ if it does not exist.

If there are multiple solutions, print any one of them.

예제 입력 1

3
5 3 2
8 2 4
13 5 7

예제 출력 1

2 0 3 1 4
-1
0 5 10 3 8 1 6 11 4 9 2 7 12