import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class rectangle {
	int x,y;
	rectangle(int x, int y){
	 this.x = x;
	 this.y= y;
 }
	static int compare(rectangle r1, rectangle r2){
		return r1.x-r2.x==0?r2.y-r1.y:r2.x-r1.x;
	}
	public static void main(String[] args) {
		String res="YES";
		int xcnt=0;
		int ycnt=0;
		Scanner sc = new Scanner(System.in);
		List<rectangle> rectangles = new ArrayList<rectangle>();
		for(int i=0; i<4;i++) {
			int x1=sc.nextInt();
			int y1=sc.nextInt();
			int x2=sc.nextInt();
			int y2=sc.nextInt();
		rectangles.add(new rectangle(x1, y1));
		rectangles.add(new rectangle(x1, y2));
			if (x1 == x2 && y1 == y2 || x1 != x2 && y1 != y2)
				res = "NO";
			else if (x1 == x2) {
				xcnt++;
			}
			else if (y1 == y2)
				ycnt++;
			}
		if(xcnt!=2||ycnt!=2) {
			res="NO";
		}
	
	Collections.sort( rectangles, new Comparator<rectangle>() {
	       public int compare(rectangle x1, rectangle x2) {
	         int result = Long.compare(x1.x, x2.x);
	         if ( result == 0 ) {
	             result = Long.compare(x1.y, x2.y);
	           } 
	         return result;
	      }
	    });
	
	for(int i=0; i<8;i++) {
		//System.out.println(rectangles.get(i).x+" "+rectangles.get(i).y);
	}
	
	for(int i=1; i<8; i++) {
		int z =compare(rectangles.get(i-1),rectangles.get(i));
		//System.out.println(z);
		
		if((i%2!=0&&z!=0)||(i%2==0&&z==0)) {
			//System.out.println(rectangles.get(i).x+" "+rectangles.get(i).y+" "+i);
			//System.out.println("HII");
			res="NO";
			break;
		}
	 }
	System.out.println(res);
  }
}
