import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner scan= new Scanner(System.in);
		int[] allxy= new int[16];
		int[] hashx= new int[8];
		int[] hashy= new int[8];
		HashMap<Integer, Integer> hs = new HashMap<Integer,Integer>(8);
		
		for(int i=0;i<16;i++)
		{
			allxy[i] =scan.nextInt();
			if(i%2==0)
				hashx[allxy[i]]++;
			else
				hashy[allxy[i]]++;
		}
		
		for(int i=0;i<15;i++)
		{
			if(i%2==0)
				hs.put(allxy[i], allxy[i+1]);
		}
		
		int i=0;
		int count=0;
		while(i<15)
		{
			if(hashx[allxy[i]]>1)
			{
				if(hashy[hs.get(allxy[i])]>1){
					hashy[hs.get(allxy[i])]=0;
					hashx[allxy[i]]=0;
					count++;
				}
					
			}
			i+=2;	
		}
		
		
		if(count>=2)
			System.out.println("YES");
		else
			System.out.println("NO");
		
		
		
					
		
	}

}
