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]]++
		val_count[arg[i][1]]++

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

	if (m.filter((x, i, self) => self.indexOf(x) === i).length !== 3) {
		console.log("NO")
		return
	}

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

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