g = Array.new(5){[]}
3.times do 
  a,b = gets.split.map(&:to_i)
  g[a] << b
  g[b] << a
end

t = []
1.upto(4) do |i| 
  if g[i].length == 1
    t << i
  end
end
a,b = g[t[0]][0],g[t[1]][0]
puts (a != b && g[a].length == 2 && g[b].length == 2) ? "YES" : "NO"