import java.io.*;
import java.util.*;
public class Foursegment {
public static void main(String[] args) throws Exception
{
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    PrintWriter pw=new PrintWriter(System.out);
    int[] a=new int[4];
    int[] b=new int[4];
    int[] c=new int[4];
    int[] d=new int[4];
    double[] l=new double[4];
    //HashMap<pair,Integer> h=new HashMap<pair,Integer>();
    pair[] p=new pair[8];
    int ver=0;
    int hor=0;
    int count=-1;
    for(int i=0;i<4;i++)
    {
        StringTokenizer st=new StringTokenizer(br.readLine());
        a[i]=Integer.parseInt(st.nextToken());
        b[i]=Integer.parseInt(st.nextToken());
        c[i]=Integer.parseInt(st.nextToken());
        d[i]=Integer.parseInt(st.nextToken());
        if(a[i]==c[i])
        {
            ver++;
        }
        if(b[i]==d[i])
        {
            hor++;
        }
        pair p1=new pair(a[i],b[i]);
        boolean aaa=false;
            for(int z=0;z<=count;z++)
            {
                if(p[z].x==p1.x && p[z].y==p1.y)
                {
                    aaa=true;
                    break;
                }
            }
        if(!aaa)
        {
            p[++count]=p1;
        }
            
        
        pair p2=new pair(c[i],d[i]);
        aaa=false;
        for(int z=0;z<=count;z++)
        {
            if(p[z].x==p2.x && p[z].y==p2.y)
            {
                aaa=true;
                break;
            }
        }
    if(!aaa)
    {
        p[++count]=p2;
    }
        int x1=Math.abs(a[i]-c[i]);
        int x2=Math.abs(b[i]-d[i]);
        l[i]=Math.sqrt(x1*x1+x2*x2);
    }
    
    if(count!=3 || hor!=2 || ver!=2)
    {
        System.out.println("NO");
        System.exit(0);
    }
    pair[] q=new pair[4];
    for(int i=0;i<4;i++)
    {
        q[i]=p[i];
    }
    Arrays.sort(q);
    /*for(int i=0;i<=3;i++)
    {
        System.out.println(q[i].x+" "+q[i].y);
    }*/
    if(q[0].x==q[1].x && q[2].x==q[3].x && q[0].y==q[2].y && q[1].y==q[3].y)
    {
        System.out.println("YES");
    }
    else
    {
        System.out.println("NO");
    }
}
}
class pair implements Comparable<pair>
{
    int x;
    int y;
    public pair(int x,int y)
    {
        this.x=x;
        this.y=y;
    }
    @Override
    public int compareTo(pair p) {
        //System.out.println("hello "+p.x+"  "+this.x);
        if(p.x>this.x)
        {
            return -1;
        }
        else if(p.x<this.x)
        {
            return 1;
        }
        else if(p.y<this.y)
        {
            return 1;
        }else if(p.y>this.y)
        {
            return -1;
        }
        return 0;
    }
    
}