a = []
b = []

for i in 0..2

    a[i],b[i] = gets.split.map(&:to_i)

end

c = []
i = 0

[0, 1].repeated_permutation(4) do |bits|
    c[i] = bits 
    i += 1
end



d = []

for i in 0..15

    d[i] = 0

    if c[i].count(1) == 2 

        for j in 0..3

            if c[i][j] == 0

                if a.count(j+1)+b.count(j+1) != 1

                    d[i] = 1

                end

            else

                if a.count(j+1)+b.count(j+1) != 2

                    d[i] = 1

                end
            
            end

        end

    else

        d[i] = 1

    end

end

if d.inject(:+) == 15

    puts 'YES'

else

    puts 'NO'

end

                

            





