Algorithm


B. Z mod X = C
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You are given three positive integers abc (a<b<c�<�<�). You have to find three positive integers xyz such that:

 

xmody=a,�mod�=�,
ymodz=b,�mod�=�,
zmodx=c.�mod�=�.

 

Here pmodq�mod� denotes the remainder from dividing p by q. It is possible to show that for such constraints the answer always exists.

Input

The input consists of multiple test cases. The first line contains a single integer t (1t100001≤�≤10000) — the number of test cases. Description of the test cases follows.

Each test case contains a single line with three integers abc (1a<b<c1081≤�<�<�≤108).

Output

For each test case output three positive integers xyz (1x,y,z10181≤�,�,�≤1018) such that xmody=a�mod�=�ymodz=b�mod�=�zmodx=c�mod�=�.

You can output any correct answer.

Example
input
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;�mod�=12mod11=1;

 

 

ymodz=11mod4=3;�mod�=11mod4=3;

 

 

zmodx=4mod12=4.

 



 

Code Examples

#1 Code Example with C++ Programming

Code - C++ Programming

#include<bits/stdc++.h>
using namespace std;


#define ll long long
#define endl '\n'
#define debug(n) cout<<(n)<<endl;
const ll INF = 2e18 + 99;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int t;
  cin>>t;
  while(t--){
    int a, b, c;
    cin>>a>>b>>c;
    cout<<(a+b+c)<<" "<<(b+c)<<" "<<(c)<<endl;
  }

}
Copy The Code & Try With Live Editor

Input

x
+
cmd
4
1 3 4
127 234 421
2 7 8
59 94 388

Output

x
+
cmd
12 11 4
1063 234 1484
25 23 8
2221 94 2609
Advertisements

Demonstration


Codeforcess Solutin 1684-B B. Z mod X = C ,C++, Java, Js and Python  ,1684-B,Codeforcess Solutin

Previous
Codeforces solution 1080-B-B. Margarite and the best present codeforces solution
Next
CodeChef solution DETSCORE - Determine the Score CodeChef solution C,C+