cnt = Array.new(5, 0)
while ln = gets
  m, n = ln.chomp.split.map(&:to_i)
  cnt[m] += 1
  cnt[n] += 1
end

for i in 1..4
  if cnt[i] == 0 || cnt[i] > 2
    puts "NO"
    break
  end
  if i == 4
    puts "YES"
  end
end