import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

void main(){
	long[] as;
	foreach(i; 0 .. 6) as ~= read.to!long;
	
	// 同じ頂点が3回出ていたら不可
	
	long[long] cnt;
	foreach(a; as) if(a !in cnt) cnt[a] = 1; else cnt[a] += 1;
	
	long max = 0;
	foreach(c; cnt) if(c > max) max = c;
	
	if(max == 3) writeln("NO");
	else writeln("YES");
	
}
