import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(in, out);
        out.close();
    }

    private static class TaskB {
        public void solve(InputReader in, PrintWriter out) {

            List<Point> list = new ArrayList<>();
            List<Segment> segments = new ArrayList<>();

            int minX = Integer.MAX_VALUE, minY = Integer.MAX_VALUE;
            int maxX = Integer.MIN_VALUE, maxY = Integer.MIN_VALUE;

            int count = 0;

            for (int i = 0; i < 4; i++) {

                int x1 = in.nextInt();
                int y1 = in.nextInt();
                int x2 = in.nextInt();
                int y2 = in.nextInt();

                minX = Math.min(minX, x1);
                minX = Math.min(minX, x2);

                maxX = Math.max(maxX, x1);
                maxX = Math.max(maxX, x2);

                minY = Math.min(minY, y1);
                minY = Math.min(minY, y2);

                maxY = Math.max(maxY, y1);
                maxY = Math.max(maxY, y2);

                Point p1 = new Point(x1, y1);
                Point p2 = new Point(x2, y2);

                segments.add(new Segment(p1, p2));

                if (!list.contains(p1)) count++;
                if (!list.contains(p2)) count++;

                list.add(p1);
                list.add(p2);
            }

            if (count != 4 || minX == maxX || minY == maxY) {
                out.println("NO");
                return;
            }

            List<Segment> temp = new ArrayList<>();
            temp.add(new Segment(new Point(minX, minY), new Point(minX, maxY)));
            temp.add(new Segment(new Point(minX, maxY), new Point(maxX, maxY)));
            temp.add(new Segment(new Point(maxX, maxY), new Point(maxX, minY)));
            temp.add(new Segment(new Point(maxX, minY), new Point(minX, minY)));

            boolean found = true;
            for (int i = 0; i < temp.size(); i++)
                if (!segments.contains(temp.get(i))) {
                    out.println(i);
                    found = false;
                    break;
                }

            if (found)
                out.println("YES");
            else out.println("NO");


        }

        private static class Segment {

            Point p1, p2;

            public Segment(Point p1, Point p2) {
                this.p1 = p1;
                this.p2 = p2;
            }

            public boolean equals(Object segment) {
                if (!(segment instanceof Segment)) return false;
                if (((Segment) segment).p1.equals(this.p1) && ((Segment) segment).p2.equals(this.p2)) return true;
                if (((Segment) segment).p1.equals(this.p2) && ((Segment) segment).p2.equals(this.p1)) return true;
                return false;
            }

            public String toString() {
                return p1 + " " + p2;
            }

        }

        private static class Point {
            int x, y;

            public Point(int x, int y) {
                this.x = x;
                this.y = y;
            }

            public boolean equals(Object point) {
                if (!(point instanceof Point)) return false;
                return ((Point) point).x == this.x && ((Point) point).y == this.y;
            }

            public String toString() {
                return x + " " + y;
            }
        }

    }

    private static class InputReader {
        StringTokenizer st;
        BufferedReader br;

        public InputReader(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public InputReader(FileReader s) throws FileNotFoundException {
            br = new BufferedReader(s);
        }

        public String next() {
            while (st == null || !st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public boolean ready() {
            try {
                return br.ready();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}