Imagine a graph of infinite nodes labelled with positive integers from 1 to .
Take every pair of nodes that are labelled with prime numbers and multiply the two prime numbers. You will get a composite number. Draw an edge between the first prime number and the composite number. Then draw another edge between the second prime number and the composite number.
You will be given two numbers. You have to tell whether there is a path between these two numbers.
The input will contain two integers and ().
Print “Yes” (w/o quotes) if there is a path between and . Otherwise, print “No” (w/o quotes).
Input | Output |
---|---|
2 15 | Yes |
There is a path from 2 to 10 to 5 to 15. |