CF2049C MEX Cycle

Description

Evirir the dragon has many friends. They have 3 friends! That is one more than the average dragon. You are given integers $ n $ , $ x $ , and $ y $ . There are $ n $ dragons sitting in a circle. The dragons are numbered $ 1, 2, \ldots, n $ . For each $ i $ ( $ 1 \le i \le n $ ), dragon $ i $ is friends with dragon $ i - 1 $ and $ i + 1 $ , where dragon $ 0 $ is defined to be dragon $ n $ and dragon $ n + 1 $ is defined to be dragon $ 1 $ . Additionally, dragons $ x $ and $ y $ are friends with each other (if they are already friends, this changes nothing). Note that all friendships are mutual. Output $ n $ non-negative integers $ a_1, a_2, \ldots, a_n $ such that for each dragon $ i $ ( $ 1 \le i \le n $ ), the following holds: - Let $ f_1, f_2, \ldots, f_k $ be the friends of dragon $ i $ . Then $ a_i = \operatorname{mex}(a_{f_1}, a_{f_2}, \ldots, a_{f_k}) $ . $ ^{\text{∗}} $ $ ^{\text{∗}} $ The minimum excluded (MEX) of a collection of integers $ c_1, c_2, \ldots, c_m $ is defined as the smallest non-negative integer $ t $ which does not occur in the collection $ c $ .

Input Format

Each test contains multiple test cases. The first line contains the number of test cases $ t $ ( $ 1 \le t \le 10^4 $ ). The description of the test cases follows. The first and only line of each test case contains three integers $ n $ , $ x $ , $ y $ ( $ 3 \le n \le 2 \cdot 10^5 $ , $ 1 \le x < y \le n $ ). It is guaranteed that the sum of $ n $ over all test cases does not exceed $ 2 \cdot 10^5 $ .

Output Format

For each test case, output $ n $ space-separated non-negative integers $ a_1, a_2, \ldots, a_n $ ( $ 0 \le a_i \le 10^9 $ ) on a line that satisfy the condition in the statement. If there are multiple solutions, print any of them. It can be proven that under the problem constraints, a solution with $ 0 \le a_i \le 10^9 $ always exists.

Explanation/Hint

For the first test case: - $ i = 1 $ : Dragon $ 1 $ 's friends are dragons $ 2, 3, 5 $ . $ \operatorname{mex}(a_2, a_3, a_5) = \operatorname{mex}(2, 1, 1) = 0 = a_1 $ , so the condition for dragon $ 1 $ is satisfied. - $ i = 2 $ : Dragon $ 2 $ 's friends are dragons $ 1, 3 $ . $ \operatorname{mex}(a_1, a_3) = \operatorname{mex}(0, 1) = 2 = a_2 $ . - $ i = 3 $ : Dragon $ 3 $ 's friends are dragons $ 1, 2, 4 $ . $ \operatorname{mex}(a_1, a_2, a_4) = \operatorname{mex}(0, 2, 0) = 1 = a_3 $ . - $ i = 4 $ : Dragon $ 4 $ 's friends are dragons $ 3, 5 $ . $ \operatorname{mex}(a_3, a_5) = \operatorname{mex}(1, 1) = 0 = a_4 $ . - $ i = 5 $ : Dragon $ 5 $ 's friends are dragons $ 1, 4 $ . $ \operatorname{mex}(a_1, a_4) = \operatorname{mex}(0, 0) = 1 = a_5 $ .