function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i]);
	};
	return tokens;
}

function main() {
	var sides = [];

	for (var i = 0; i < 4; i += 1) {
		var integers = tokenizeIntegers(readline());
		sides.push([ { x: integers[0], y: integers[1] },
					 { x: integers[2], y: integers[3] } ]);
	}

	function makeCorner(a, b) {
		for (var i = 0; i < 2; i += 1) {
			var p = a[i], q = a[(i+1)%2];
			for (var j = 0; j < 2; j += 1) {
				var r = b[j], s = b[(j+1)%2];
				if (p.y == q.y && p.x != q.x &&
						q.x == r.x && q.y == r.y &&
						r.x == s.x && r.y != s.y) {
					return true;
				}
				if (p.x == q.x && p.y != q.y &&
						q.x == r.x && q.y == r.y &&
						r.y == s.y && r.x != s.x) {
					return true;
				}
			}
		}
		//write("("+a[0].x+", "+a[0].y+") ("+a[1].x+", "+a[1].y+")");
		//print(" -> ("+b[0].x+", "+b[0].y+") ("+b[1].x+", "+b[1].y+")");
		return false;
	}

	var used = new Array(4);
	var okay = false;

	function go(attempt) {
		//print(attempt.length);
		if (attempt.length == 4) {
			if (makeCorner(attempt[3], attempt[0])) {
				okay = true;
			}
		}
		else {
			for (var i = 0; i < 4; i += 1) {
				if (used[i] === undefined) {
					if (attempt.length == 0 ||
							makeCorner(attempt[attempt.length-1], sides[i])) {
						used[i] = true;
						attempt.push(sides[i]);
						go(attempt);
						attempt.pop();
						used[i] = false;
					}
				}
			}
		}
	}

	go([]);
	print(okay ? "YES" : "NO");
}

main();
