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

public class P14C {
    class Point {
        int x, y;
        
        Point (){}
        Point (int x, int y){
            this.x = x; 
            this.y = y;
        }
    }
    
    class Line {
        Point p1, p2;
        Line (){}
        Line (Point p1, Point p2){
            this.p1 = p1;
            this.p2 = p2;
        }
    }
    
    P14C(){
        Scanner sc = new Scanner(System.in);
        Line []lines =  new Line[4];
        lines[0] = new Line(new Point(sc.nextInt(), sc.nextInt()), new Point(sc.nextInt(), sc.nextInt()));
        lines[1] = new Line(new Point(sc.nextInt(), sc.nextInt()), new Point(sc.nextInt(), sc.nextInt()));
        lines[2] = new Line(new Point(sc.nextInt(), sc.nextInt()), new Point(sc.nextInt(), sc.nextInt()));
        lines[3] = new Line(new Point(sc.nextInt(), sc.nextInt()), new Point(sc.nextInt(), sc.nextInt()));
        sc.close();
        
        /*
         * two lines || Ox and two lines || Oy
         */
        int []par = new int[4];
        par[0] = paralelLine(lines[0]);
        par[1] = paralelLine(lines[1]);
        par[2] = paralelLine(lines[2]);
        par[3] = paralelLine(lines[3]);
        
        ArrayList <Integer> horizontal = new ArrayList<>();
        ArrayList <Integer> vertical = new ArrayList<>();
        for (int i = 0; i < 4; i++){
            if (par[i] == 1){
                horizontal.add(i);
            }
            else if (par[i] == 2){
                vertical.add(i);
            }
        }
        
        if ((vertical.isEmpty() || vertical.size() != 2 ) ||
                (horizontal.isEmpty() || horizontal.size() != 2)){
            System.out.println("NO");
            return;
        }

        /*
         * lines form a rectangle
         *      - parallel lines have same coordinates
         *      - perpendicular lines have common end-points 
         */
        if (!sameLength(lines[horizontal.get(0)], lines[horizontal.get(1)], "H") ||
                !sameLength(lines[vertical.get(0)], lines[vertical.get(1)], "V")){
            System.out.println("NO");
            return;
        }

        // order coord in each line
        lines[horizontal.get(0)] = orderCoord(lines[horizontal.get(0)], "H");
        lines[horizontal.get(1)] = orderCoord(lines[horizontal.get(1)], "H");
        lines[vertical.get(0)] = orderCoord(lines[vertical.get(0)], "V");
        lines[vertical.get(1)] = orderCoord(lines[vertical.get(1)], "V");
        
        if (!formRectangle(lines[horizontal.get(0)], lines[horizontal.get(1)], lines[vertical.get(0)], lines[vertical.get(1)]) &&
                !formRectangle(lines[horizontal.get(1)], lines[horizontal.get(0)], lines[vertical.get(0)], lines[vertical.get(1)]) && 
                !formRectangle(lines[horizontal.get(0)], lines[horizontal.get(1)], lines[vertical.get(1)], lines[vertical.get(0)]) &&
                !formRectangle(lines[horizontal.get(1)], lines[horizontal.get(0)], lines[vertical.get(1)], lines[vertical.get(0)])){
            System.out.println("NO");
            return;
        }
        
        System.out.println("YES");
    }
    
    Line orderCoord (Line line, String orientation){
        if (orientation.equals("H")){
            if (line.p1.x > line.p2.x){
                Point tmp = line.p1;
                line.p1 = line.p2;
                line.p2 = tmp;
            }
        }
        else if (orientation.equals("V")){
            if (line.p1.y > line.p2.y){
                Point tmp = line.p1;
                line.p1 = line.p2;
                line.p2 = tmp;
            }
        }
        
        return line;
    }

    boolean formRectangle (Line h1, Line h2, Line v1, Line v2){
        
        if (h1.p1.x == v1.p2.x && h1.p1.y == v1.p2.y &&
                h1.p2.x == v2.p2.x && h1.p2.y == v2.p2.y &&
                v2.p1.x == h2.p2.x && v2.p1.y == h2.p2.y &&
                h2.p1.x == v1.p1.x && h2.p1.y == v1.p1.y){
            return true;
        }
        return false;
    }
    
    boolean sameLength (Line line1, Line line2, String orientation){
        if (orientation.equals("H")){
            if (line1.p1.x == line2.p1.x && line1.p2.x == line2.p2.x){
                return true;
            }
            if (line1.p1.x == line2.p2.x && line1.p2.x == line2.p1.x){
                return true;
            }
        }
        if (orientation.equals("V")){
            if (line1.p1.y == line2.p1.y && line1.p2.y == line2.p2.y){
                return true;
            }
            if (line1.p1.y == line2.p2.y && line1.p2.y == line2.p1.y){
                return true;
            }
        }
        return false;
    }
    /**
     * 
     * @param line
     * @return  1 if line || Ox
     *          2 if line || Oy
     *          -1 otherwise
     */
    int paralelLine (Line line){
        if (line.p1.y == line.p2.y){
            return 1;
        }
        if (line.p1.x == line.p2.x){
            return 2;
        }
        return -1;
    }
    
    
    
    public static void main (String args[]){
        new P14C();
    }
}
