import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Watermelon {
    static int[] x1,y1,x2,y2,l,connects;
    public static void main(String[] args) throws java.lang.Exception {
        Scanner sc = new Scanner(System.in);
        x1=new int[4];y1=new int[4];x2=new int[4];y2=new int[4];
        connects=new int[4];
        for(int i=0;i<4;i++){x1[i]=sc.nextInt();y1[i]=sc.nextInt();x2[i]=sc.nextInt();y2[i]=sc.nextInt();}
        if(!smecord()){System.out.print("NO");System.exit(0);}
        l=new int[4];
        for(int i=0;i<4;i++){
            l[i]=Math.abs((x1[i]==x2[i])?y1[i]-y2[i]:x1[i]-x2[i]);
        }
        if(!length()){System.out.print("NO");System.exit(0);}
        connect(0,0);
        if(!(connects[0]==connects[2] && connects[1]==connects[3])){System.out.print("NO");System.exit(0);}
        System.out.print((l[0]*l[1]*l[2]*l[3] !=0 )?"YES":"NO");
    }
    public static boolean smecord(){
        for(int i=0;i<4;i++){
            if(!(x1[i]==x2[i] || y1[i]==y2[i]))return false;
        }
        return true;
    }
    public static boolean length(){
        if(l[0]==l[2] && l[1]==l[3])return true;
        else if(l[0]==l[1] && l[2]==l[3])return true;
        else if(l[1]==l[2] && l[0]==l[3])return true;
        else return false;
    }
    public static void connect(int i,int index){
        if(index>=4)return;
        connects[index]=l[i];
        for(int j=0;j<4;j++){
//            System.out.println(i+" "+j);
            if(i!=j && ((x2[i]==x1[j] && y2[i]==y1[j]) || (x2[i]==x2[j] && y2[i]==y2[j]))){
                connect(j,index+1);
            }
        }
    }

}


