Find X and Y in Linear Equation
Submissions: 1277   Accuracy:


  Difficulty: Basic   Marks: 1

Given a, b and n. Find x and y that satisfies equation ax + by = n. 

Input: The first line consists of an integer T i.e. the number of test cases. First and last line of each test case consists of three integers a,b and n

Output: Print the required values of x and y with a space in between. In case when no X and Y is possible, please output "No solution" (i.e. w/o quotes).

Constraints : 
1 <= T <= 100
1 <= a,b,n <= 104


2 3 7
4 2 7

2 1
No solution

** For More Input/Output Examples Use 'Expected Output' option **

Author: saksham0751

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.

Need help with your code? Please use, generate link and share the link here.

to report an issue on this page.