#P11074. 火大

火大

Background

Problem Description

Given two positive integers n,mn, m, find a sequence a1,a2,,ana_1, a_2, \cdots, a_n of length nn that satisfies the following two requirements.

  • For any integer ii with 1in1 \le i \le n, we have 0ai<m0 \le a_i < m, and aia_i is an integer.
  • For any integers i,ji, j with 1ijn1 \le i \le j \le n, there exists an integer kk with 1kj1 \le k \le j such that ak[m(i1)j,mij)a_k \in [\frac{m(i-1)}{j}, \frac{mi}{j}).

If such a sequence aa exists, output a construction; otherwise output fire big.

Input Format

This problem has multiple test cases.

The first line contains a positive integer TT, representing the number of test cases.

Then follow TT test cases. For each test case, input two positive integers n,mn, m, with the meaning as described in the statement.

Output Format

For each test case, if there exists a sequence aa that satisfies the requirements, output one line with nn numbers representing the sequence aa. Otherwise, output one line fire big.

5
1 1
2 2
3 3
4 100
100 5
0
0 1
0 2 1
1 50 99 30
fire big

Hint

The Luogu code length limit is 50 KB\textbf{50\ KB}.

Scoring

For a certain test point, if your output correctly determines whether a solution exists or not, you can get at least 40%40\% of the score.

In particular, if your output format is invalid, you may get 00 points. One valid output format is outputting nn zeros on each line.

Constraints

For all testdata, it is guaranteed that 1n1031 \le n \le 10^3, 1T4.4×1041 \le T \le 4.4\times 10^4, 1n<1061 \le \sum n < 10^6, and 1m1081 \le m \le 10^8.

There are 1212 test points in total, and the test points are not equally weighted. The detailed score of each test point is as follows.

Test Point ID Score nn mm
11 55 3\le 3 =n=n
22 5\le 5 5\le 5
33 =108=10^8
44 108\le 10^8
55 10\le 10 =n=n
66 108\le 10^8
77 103\le 10^3 <n<n
88 1010 15\le 15 100\le 100
99 108\le 10^8
1010 1515 44\le 44 103\le 10^3
1111 103\le 10^3 =108=10^8
1212 100\le 100 108\le 10^8

Translated by ChatGPT 5