|Codeforces Round #540 (Div. 3)|
The king of Berland organizes a ball! $$$n$$$ pair are invited to the ball, they are numbered from $$$1$$$ to $$$n$$$. Each pair consists of one man and one woman. Each dancer (either man or woman) has a monochrome costume. The color of each costume is represented by an integer from $$$1$$$ to $$$k$$$, inclusive.
Let $$$b_i$$$ be the color of the man's costume and $$$g_i$$$ be the color of the woman's costume in the $$$i$$$-th pair. You have to choose a color for each dancer's costume (i.e. values $$$b_1, b_2, \dots, b_n$$$ and $$$g_1, g_2, \dots g_n$$$) in such a way that:
Let's take a look at the examples of bad and good color choosing (for $$$n=4$$$ and $$$k=3$$$, man is the first in a pair and woman is the second):
Bad color choosing:
Good color choosing:
You have to find any suitable color choosing or say that no suitable choosing exists.
The only line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n, k \le 2 \cdot 10^5$$$) — the number of pairs and the number of colors.
If it is impossible to find any suitable colors choosing, print "NO".
Otherwise print "YES" and then the colors of the costumes of pairs in the next $$$n$$$ lines. The $$$i$$$-th line should contain two integers $$$b_i$$$ and $$$g_i$$$ — colors of costumes of man and woman in the $$$i$$$-th pair, respectively.
You can print each letter in any case (upper or lower). For example, "YeS", "no" and "yES" are all acceptable.
YES 3 1 1 3 3 2 2 3
YES 2 1 1 3 4 2 3 4 4 3 3 2 2 4 4 1 1 4 3 1