SMPDIV - Divisibility

Print all integers ai such that ai is divisible by x and not divisible by y, where 1 < ai < n < 100000.

Input

First, you are given t (t < 100) - the number of test cases. In each of the following t lines, 3 integers: n x y.

You might assume also that x < n and x is not divisible by y.

Output

In each of the following t lines, numbers requested in the problem description in the separated by a single space in ascending order.

Example

Input:
2
7 2 4
35 5 12
Output:
2 6
5 10 15 20 25 30

Added by:kuszi
Date:2013-08-26
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

hide comments
2016-01-23 12:12:55
[deleted] thanks for explaining problem. Initially me too didnt understood the problem statement. You saved me. Problem is Easy One though.
2016-01-18 19:15:11
can anyone help me solving this prob:(:(:(:d
2015-12-07 13:52:49 Micha³ Krokocki
Watch out for the spaces on the ends - it cost me one Runtime Error
2015-11-14 12:05:47 newbie
easy one ac in 0.00
2015-10-25 05:18:31 pvkcse
@pankajnegi112 Read the problem statement carefully...
2015-10-19 18:49:46
yeah, i'm also getting wrong answer though it worked fine on ideone.

Last edit: 2015-10-19 19:35:31
2015-09-30 20:26:53
@ankitsnigam ..still i am confused with your first case ..if n=7,x=5,y=4 but you are saying to divide it by 2 and 4..how could we do it ..what is the cocept of this..if you are can explain it more simple way the it would help me alot.....
2015-09-25 07:59:10
please help me out to find the logic ...i am not getting what program is trying to say it...kindly help me
2015-09-09 00:14:19
My python code works fine with the example in ideone, why am I getting wrong answer here?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.