 import java.util.Scanner;


public class Main 
{
    
    public static void main(String[] args)
    {
        Scanner s = new Scanner(System.in);
        int y[]=new int[8];
        int x[]=new int[8];
        int d[]=new int[8];
        int j=0;
        int i=0;
        Boolean cs[]=new Boolean[8];
        int cl[]=new int[4];
        int sch=0;
        for(i=0;i<8;i++)
        {
             x[i]=s.nextInt();
             y[i]=s.nextInt();
             d[i]=0;
             cs[i]=false;
             if(i<4)
             {
                 cl[i]=0;
             }
        }
        for(i=0;i<8;i++)
        {
             if(i%2==1)
             {
                 if(x[i-1]!=x[i]&&y[i-1]!=y[i])
                 {
                     System.out.println("NO");
                     return;
                 }
             }
        }
        for(i=0;i<8;i++)
        {
            int iline=i/2;
            cs[i]=true;
            for(j=0;j<8;j++)
            {
                int jline=j/2;
                if(jline!=iline)
                {
                    if(cl[iline]!=jline)
                    {
                        if(!cs[j])
                        {
                           if(x[i]==x[j]&&y[i]==y[j])
                           {
                               sch++;
                               cs[j]=true;
                               cl[iline]=jline;
                               cl[jline]=iline;
                           }
                        }
                    }
                }

            }
        }
        if(sch==4)
        {
            System.out.print("YES");
        }
        else
        {
            System.out.print("NO");
        }
    }

}