import java.util.ArrayList;
import java.util.Scanner;

public class Solution {
    private static class Point {
        public int x, y;
        public Point(int a, int b){
            this.x = a;
            this.y = b;
        }

        public boolean equals(Point obj) {
            return this.x == obj.x && this.y == obj.y;
        }
    }

    public static void main(String [] args){
        Scanner in = new Scanner(System.in);

        ArrayList <Point> mas = new ArrayList <Point>();
        ArrayList <Point> rmas = new ArrayList<Point>();

        int left = 2000000000,right = -2000000000,top = -2000000000,bottom = 2000000000;
        for (int i=0;i<4;i++){
            int a = in.nextInt(), b = in.nextInt(), c = in.nextInt(), d = in.nextInt();
            if (a < left){
                left = a;
            }
            if (a > right){
                right = a;
            }
            if (c < left){
                left = c;
            }
            if (c > right){
                right = c;
            }
            if (b < bottom){
                bottom = b;
            }
            if (b > top){
                top = b;
            }
            if (d < bottom){
                bottom = d;
            }
            if (d > top){
                top = d;
            }
            mas.add(new Point(a,b));
            rmas.add(new Point(c,d));
        }

        boolean [] used = {true, false, false, false};
        Point last = rmas.get(0);
        Point start = mas.get(0);
        for (int i=0;i<3;i++){
            for (int j=0;j<4;j++){
                if (!used[j] && (mas.get(j).equals(last) || (rmas.get(j).equals(last)))){
                    if (mas.get(j).equals(last)){
                        last = rmas.get(j);
                    } else {
                        last = mas.get(j);
                    }
                    used[j] = true;
                }
            }
        }

        boolean haveTrap = false;
        for (int i=0;i<4;i++){
            if (!used[i]){
                haveTrap = true;
            }
        }

        if (last.equals(start) && !haveTrap && ((right-left)*(top-bottom) > 0)){
            System.out.print("YES");
        } else {
            System.out.print("NO");
        }

    }
}
