import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner scan= new Scanner(System.in);
		ArrayList<Integer> xx = new ArrayList<Integer>();
		ArrayList<Integer> yy = new ArrayList<Integer>();
		ArrayList<Integer> xsegment = new ArrayList<Integer>();
		ArrayList<Integer> ysegment = new ArrayList<Integer>();
		for(int i=0;i<16;i++)
		{
			if(i%2 == 0)
				xx.add(scan.nextInt());
			else
				yy.add(scan.nextInt());
		}
		for(int i=0;i<8;i++)
		{
			if(i%2==0)
			{
				if((xx.get(i) != xx.get(i+1) && yy.get(i) != yy.get(i+1)) || (xx.get(i) == xx.get(i+1) && yy.get(i) == yy.get(i+1)))
				{
					System.out.println("NO");
				}
				else
				{
					if(xx.get(i) == xx.get(i+1))
					{
						xsegment.add(xx.get(i));
						xsegment.add(yy.get(i));
						xsegment.add(xx.get(i+1));
						xsegment.add(yy.get(i+1));
						}else
					{
						ysegment.add(xx.get(i));
						ysegment.add(yy.get(i));
						ysegment.add(xx.get(i+1));
						ysegment.add(yy.get(i+1));
					}
				}
			}
		}
		
		if(xsegment.size()==8)
		{
			if((xsegment.get(1) == xsegment.get(5) || xsegment.get(1) == xsegment.get(7)) && (xsegment.get(3) == xsegment.get(5) || xsegment.get(3) == xsegment.get(7)) && 
					xsegment.get(0) != xsegment.get(4)) 
			{
				if((ysegment.get(0) == ysegment.get(4) || ysegment.get(0) == ysegment.get(6))&& (ysegment.get(2) == ysegment.get(4) || ysegment.get(2) == ysegment.get(6)) &&
						ysegment.get(1)!= ysegment.get(5) )
					System.out.println("YES");
			}
			else
				System.out.println("NO");
		}
		else
			System.out.println("NO");
		
	}

}
