import java.util.Scanner

fun main(args: Array<String>) {
  val scanner = Scanner(System.`in`)
  val input:CharArray = (scanner.next() + scanner.next() + scanner.next() + scanner.next() + scanner.next() + scanner.next()).toCharArray().sorted().toCharArray()
  scanner.close()
  for (i in 0..4) {
    if (input[i+0] == input[i+1] && input[i+1] == input[i+2] && input[i+2] == input[i+0]) {
      print("NO")
      return
    }
  }
  print("YES")
}