fork download
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
	Scanner sc = new Scanner(System.in); 
            int a = Integer.parseInt(sc.nextLine()); 
            int b = Integer.parseInt(sc.nextLine()); 
            int c = Integer.parseInt(sc.nextLine()); 
            int d = Integer.parseInt(sc.nextLine()); 
            if (a==c || b==d){
            	System.out.println("YES"); 
            }else{
            
            	    System.out.println("NO"); 
                    
}
}
}
        
Success #stdin #stdout 0.07s 4386816KB
stdin
4
4
5
5
stdout
NO