Given a number (as string) and two integers a and b, divide the string in two non-empty parts such that the first part is divisible by a and second part is divisible by b. If string can not be divided into two non-empty parts, output "-1”, else print the two parts.

**Input:**

The first line of input contains a single integer T denoting the number of test cases. Then T test cases follow. Each test case consists of single line containing 3 space seperated number denoting the respective values of n, a and b.

**Output:**

For each test case output a single line containing the two space seperated non-empty parts else print -1.

**Constraints:**

1<=T<=100

1<=N<=10^{6}

1<=a,b<=N

**Example:**

**Input:**

3

1200 4 3

123 12 3

125 12 5

**Ouput:**

12 00

12 3

12 5

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

jhasaurabh312 | 138 |

Aaaaarohiiii | 136 |

Harsha_kunchala | 128 |

tushki | 124 |

RajaRajput | 117 |

ARUN_PUNDIR | 617 |

manishgupta8497 | 607 |

Abhimanyu_kumar | 559 |

KhyatiSoneji | 501 |

Aman___Jain | 496 |

blackshadows | 5335 |

Ibrahim Nash | 5223 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4567 |

Login to report an issue on this page.