import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
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);
        c14 solver = new c14();
        solver.solve(1, in, out);
        out.close();
    }

    static class c14 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            rect r = new rect();
            r.readXY(in);
            r.readXY(in);
            r.readXY(in);
            r.readXY(in);

            if (!r.reconstr()) {
                out.println("NO");
                return;
            }

            long s = (r.maxX - r.minX) * (r.maxY - r.minY);
            if (s > 0) {
                out.println("YES");
            } else {
                out.println("NO");
            }
        }

        class rect {
            int minX = Integer.MAX_VALUE;
            int maxX = Integer.MIN_VALUE;
            int minY = Integer.MAX_VALUE;
            int maxY = Integer.MIN_VALUE;
            int hor = 0;
            int ver = 0;
            boolean point = false;
            ArrayList<line> lines = new ArrayList<>();

            void readXY(InputReader in) {
                int x1 = in.nextInt();
                int y1 = in.nextInt();
                int x2 = in.nextInt();
                int y2 = in.nextInt();

                boolean h = false;

                if (x1 == x2 && y1 == y2) {
                    point = true;
                } else if (x1 == x2) {
                    ver++;
                    h = false;
                    minX = Math.min(minX, x1);
                    maxX = Math.max(maxX, x1);
                } else if (y1 == y2) {
                    hor++;
                    h = true;
                    minY = Math.min(minY, y1);
                    maxY = Math.max(maxY, y1);
                }
                lines.add(new line(x1, y1, x2, y2, h));
            }

            boolean reconstr() {
                int cnt = 0;
                for (int i = 0; i < lines.size(); i++) {
                    if (lines.get(i).equals(new line(minX, minY, maxX, minY, true))) cnt++;
                }
                for (int i = 0; i < lines.size(); i++) {
                    if (lines.get(i).equals(new line(minX, maxY, maxX, maxY, true))) cnt++;
                }
                for (int i = 0; i < lines.size(); i++) {
                    if (lines.get(i).equals(new line(minX, minY, minX, maxY, true))) cnt++;
                }
                for (int i = 0; i < lines.size(); i++) {
                    if (lines.get(i).equals(new line(maxX, minY, maxX, maxY, true))) cnt++;
                }
                if (cnt == 4)
                    return true;
                return false;
            }

        }

        class line {
            int x1;
            int y1;
            int x2;
            int y2;
            boolean hor;

            line(int x1a, int y1a, int x2a, int y2a, boolean h) {
                x1 = x1a;
                y1 = y1a;
                x2 = x2a;
                y2 = y2a;
                hor = h;
            }

            public boolean equals(Object obj) {
                line l = (line) obj;
                if (l.x1 == x1 && l.y1 == y1 && l.x2 == x2 && l.y2 == y2) return true;
                if (l.x1 == x2 && l.y1 == y2 && l.x2 == x1 && l.y2 == y1) return true;
                return false;
            }

        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer stt;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        public String next() {
            while (stt == null || !stt.hasMoreTokens()) {
                stt = new StringTokenizer(nextLine());
            }
            return stt.nextToken();
        }

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

    }
}

