import scala.io.StdIn
object Main extends App {
   
   val a = Array.ofDim[Int](10)
   val x = StdIn.readLine().foreach{ c =>
      a(c.toString.toInt) += 1
   }
   println(if(a.exists(p => p >= 3)) "Yes" else "No")
}
