| Contests - ACM Student Chapter - PSUT |
|---|
| Private |
| Spectator |
| GJU JCPC Qualification 2026 |
|---|
| Finished |
Abushogi owns a famous restaurant that serves exactly $$$n$$$ dishes. The dishes are listed in a menu and are indexed from $$$1$$$ to $$$n$$$.
Void asked Moon to order a specific dish from the menu. However, by the time Moon reached the counter, he had completely forgotten the name of the dish!
The only thing Moon remembers is a mathematical clue about the 1-based index of the dish: he remembers that the index $$$i$$$ satisfies the equation $$$i \bmod x = y$$$.
Given the names of the $$$n$$$ dishes on Abushogi's menu, help Moon by outputting the names of all the possible dishes that Void might have asked for, in the order they appear on the menu. If no dish in the menu satisfies this condition, output 0.
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.
The first line of each test case contains three integers $$$n$$$, $$$x$$$, and $$$y$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le x \le 10^9$$$, $$$0 \le y \lt x$$$) — the number of dishes, the modulo, and the remainder.
The second line of each test case contains $$$n$$$ strings — the names of the dishes. Each string consists only of lowercase English letters and has a length between $$$1$$$ and $$$10$$$.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.
For each test case, output the names of all possible dishes separated by a space. If there are no such dishes, output 0.
45 2 1sushi ramen tempura udon mochi4 3 0pizza burger pasta salad3 10 5steak ribs chicken5 1 0a b c d e
sushi tempura mochi pasta 0 a b c d e
In the first testcase, indices 1, 3, and 5 modulo 2 equal 1.
In the second case, only 3 works
| Name |
|---|

