QOJ.ac

QOJ

时间限制: 1 s 内存限制: 1024 MB 总分: 100 可 Hack ✓

#18296. Simple Game

统计

Let $s$ be an arithmetic progression consisting of $2 n$ integers, where the first term is denoted as $a$ and the common difference as $b$. In other words, $s = (a, a + b, a + 2 b, \ldots, a + (2 n - 1) b)$.

You should perform a sequence of $n$ operations, where each operation involves selecting two coprime integers from $s$ and erasing them. Once an integer is erased from $s$, it cannot be selected again for any subsequent operation.

Find any sequence of operations satisfying the above conditions or report that such a sequence does not exist.

Input

The first and only line contains three integers: $n$, $a$, and $b$ ($1 \leq n \leq 10^5$, $1 \leq a, b \leq 10^9$).

Output

On the first line, print "No" if no such sequence of operations exists.

Otherwise, print "Yes", followed by $n$ more lines. On each of these lines, print the two integers selected from $s$ for the corresponding operation.

If there are multiple possible answers, print any one of them.

Examples

Input 1

2 1 1

Output 1

Yes
1 4
2 3

Input 2

4 4 6

Output 2

No

Input 3

3 995069485 940582184

Output 3

Yes
3816816037 4757398221
5697980405 1935651669
2876233853 995069485

Note

Two integers are said to be coprime if the only positive integer that divides both of them is $1$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.