fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define boost ios::sync_with_stdio(false);cin.tie(NULL)
  5. #define ll long long
  6. #define ull unsigned long long
  7. #define pll pair<ll,ll>
  8. #define pb push_back
  9. #define mp make_pair
  10. #define F first
  11. #define S second
  12. #define MOD 1000000007
  13.  
  14. int main()
  15. {
  16. boost;
  17. if(fopen("inp.txt", "r")) {
  18. freopen("inp.txt", "r", stdin);
  19. freopen("outp.txt", "w", stdout);
  20. }
  21.  
  22. ll t;
  23. cin>>t;
  24.  
  25. ll w[3];
  26.  
  27. while (t--) {
  28. cin>>w[0]>>w[1]>>w[2];
  29.  
  30. sort(w,w+3);
  31.  
  32. ll cnt=0;
  33. cnt+=(w[0]&1);
  34. cnt+=(w[1]&1);
  35. cnt+=(w[2]&1);
  36.  
  37. if (cnt==1 || cnt==3)
  38. cout<<"-1\n";
  39. else {
  40. cout<<"0 0 "<<w[0]<<" 0 ";
  41.  
  42. ll x=(w[1]-w[2]+w[0])>>1, y=(w[1]+w[2]-w[0])>>1;
  43.  
  44. cout<<x<<" "<<y<<endl;
  45. }
  46. }
  47.  
  48. return 0;
  49. }
Success #stdin #stdout 0s 15240KB
stdin
3
3 5 4
30 1 20
5 10 12
stdout
0 0 3 0 1 3
-1
-1