fork download
  1. import java.util.*;
  2.  
  3. public class Main{
  4. public static void main(String args[]){
  5. Scanner sc = new Scanner(System.in);
  6.  
  7. int t = sc.nextInt();
  8.  
  9. while(t-- > 0){
  10.  
  11. int a[][] = new int[2][2];
  12.  
  13. for(int i=0;i<2;i++){
  14. for(int j=0;j<2;j++){
  15. a[i][j] = sc.nextInt();
  16. }
  17. }
  18.  
  19. boolean flag = false;
  20.  
  21. for(int i=0;i<4;i++){
  22. if(a[0][0] < a[0][1] && a[1][0] < a[1][1] && a[0][0] < a[1][0] && a[0][1] < a[1][1]){
  23. flag = true;
  24. break;
  25. }
  26.  
  27. int temp = a[0][0];
  28. a[0][0] = a[1][0];
  29. a[1][0] = a[1][1];
  30. a[1][1] = a[0][1];
  31. a[0][1] = temp;
  32.  
  33. }
  34.  
  35. if(flag){
  36. System.out.println("YES");
  37. }else{
  38.  
  39. System.out.println("NO");
  40. }
  41.  
  42. }
  43. }
  44. }
Success #stdin #stdout 0.14s 56624KB
stdin
6
1 3
5 7
8 10
3 4
8 10
4 3
6 1
9 2
7 5
4 2
1 2
4 3
stdout
YES
YES
NO
YES
YES
NO