#K52917. Team Building Event Assignment

    ID: 29416 Type: Default 1000ms 256MiB

Team Building Event Assignment

Team Building Event Assignment

A company is organizing a series of team-building events for its employees. The goal is to assign a group (represented by an employee number) to each event under the following conditions:

  • There are M events.
  • There are E employees available, and each event is led by one employee (thus forming the group with that employee’s number).
  • Each employee can lead at most P events. This implies that the total number of events cannot exceed \(E \times P\).
  • The assignment must also ensure that no event is led by the same employee as the immediately preceding event (i.e. consecutive events must have different employee numbers).

Your task is to determine a valid assignment of employees to the events that satisfies the above rules, or report that it is impossible. If there exist multiple valid assignments, any one of them is acceptable.

Input Constraints:

  • \(1 \leq T \leq 100\) — the number of test cases
  • For each test case, three integers \(M\), \(E\), and \(P\) are given as described above.

Note: All formulas are in \(\LaTeX\) format.

inputFormat

The first line of input contains an integer T representing the number of test cases. Each of the following T lines contains three space-separated integers M, E, and P as described above.

outputFormat

For each test case, output one line:

  • If no valid assignment exists, output -1.
  • If a valid assignment exists, output M space-separated integers. The i-th integer represents the employee (group) assigned to the i-th event. The output must ensure that no two consecutive integers are the same.
## sample
2
5 3 2
6 4 1
1 2 3 1 2

-1

</p>