unittest
{
	assert( [ "4 2", "1 3", "2 3" ].parse.expand.solve == "YES" );
	assert( [ "3 2", "2 4", "1 2" ].parse.expand.solve == "NO" );
	assert( [ "2 1", "3 2", "4 3" ].parse.expand.solve == "YES" );
	
	assert( [ "1 2", "2 3", "3 1" ].parse.expand.solve == "NO" );		// 追加ケース
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto abs = new long[ 2 ][ 3 ];
	foreach( ref ab; abs )
	{
		ab = input.front.split.to!( long[] );
		ab[] -= 1;
		input.popFront;
	}
	return tuple( abs );
}

auto solve( long[ 2 ][] abs )
{
	auto cs = new long[ 4 ];
	foreach( ab; abs )
	{
		cs[ ab[ 0 ] ]++;
		cs[ ab[ 1 ] ]++;
	}
	return ( cs.filter!( ( c ) => c < 1 || 2 < c ).empty ) ? "YES" : "NO";
}
