Z mod X = C solution codeforces
You are given three positive integers aa, bb, cc (a<b<ca<b<c). You have to find three positive integers xx, yy, zz such that:
xmody=a,xmody=a,
ymodz=b,ymodz=b,
zmodx=c.zmodx=c.
Here pmodqpmodq denotes the remainder from dividing pp by qq. It is possible to show that for such constraints the answer always exists.
Input
Z mod X = C solution codeforces
The input consists of multiple test cases. The first line contains a single integer tt (1≤t≤100001≤t≤10000) — the number of test cases. Description of the test cases follows.
Each test case contains a single line with three integers aa, bb, cc (1≤a<b<c≤1081≤a<b<c≤108).
Output
For each test case output three positive integers xx, yy, zz (1≤x,y,z≤10181≤x,y,z≤1018) such that xmody=axmody=a, ymodz=bymodz=b, zmodx=czmodx=c.
You can output any correct answer.
Example
input
Z mod X = C solution codeforces
Copy
4 1 3 4 127 234 421 2 7 8 59 94 388
output
Copy
12 11 4 1063 234 1484 25 23 8 2221 94 2609
Note
In the first test case:
xmody=12mod11=1;xmody=12mod11=1;
ymodz=11mod4=3;ymodz=11mod4=3;
zmodx=4mod11=4.zmodx=4mod11=4.