fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int t;
  6. cin >> t;
  7. for(int i=0;i<t;i++)
  8. {
  9. long long int a,b,c,d;
  10. cin >> a >> b >> c >> d;
  11. if(a<b)
  12. {
  13. if(c>d)
  14. {
  15. a=a+c;
  16. b=b+d;
  17. }
  18. else
  19. {
  20. a=a+d;
  21. b=b+c;
  22. }
  23.  
  24. }
  25. else
  26. {
  27. if(c>d)
  28. {
  29. a=a+d;
  30. b=b+c;
  31. }
  32. else
  33. {
  34. a=a+c;
  35. b=b+d;
  36. }
  37.  
  38. }
  39. if(a==b)
  40. {
  41. cout << "YES" << endl;
  42. }
  43. else
  44. {
  45. cout << "NO" << endl;
  46. }
  47. }
  48. return 0;
  49. }
Success #stdin #stdout 0s 4552KB
stdin
2
3 4 1 2
10 20 3 7
stdout
YES
NO