function main(arg) {
	arg = arg.split("\n").map(e => e.split(" ").map(x => Number(x)).sort((a,b) => a - b))
	// console.log(arg)

	var val_count = [0,0,0,0] 


	var m = []
	for (var i = 0; i < arg.length; i++) {
		if (arg[i][0] === arg[i][1]) {
			console.log("NO")
			return;
		}

		val_count[arg[i][0] - 1]++
		val_count[arg[i][1] -1]++

		m.push(arg[i].join(""))
	}

	m.sort()

	for (var i = 1; i < m.length; i++ ) {
		if (m[i] === m[i-1]) {
			console.log("NO")
			return
		}
	}

	for (var i = 0; i < val_count.length; i++) {
		if (val_count[i] == 0 || val_count[i] > 2) {
			console.log("NO")
			return
		}
	}
	
	console.log("YES")

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
