Game
The child has drawn N (N ≤ 100) numbered circles, each in a different color. She has connected some of these circles with colored arrows. Any pair of circles can be connected by multiple arrows of various colors. Each color is assigned a number not exceeding 100.
Before the game begins, the child places one token on the circle numbered L and another on a different circle numbered K. The goal is to reach a different circle numbered Q. The game follows these rules:
A token can move along an arrow from its current circle if the arrow's color matches the color of the circle where the other token is located.
The two tokens cannot occupy the same circle simultaneously.
There is no fixed order for moving the tokens; they can be moved freely.
The game concludes when either token reaches the circle numbered Q.
Your task is to write a program that calculates the minimum number of moves required to finish the game, if it is possible to do so.
Input
The first line of input contains the numbers N, L, K, Q, separated by spaces. The second line lists N integers c_1, c_2, ..., c_N, separated by spaces, where c_i represents the color of the circle numbered i. The third line contains a single number M (0 ≤ M ≤ 10000), indicating the total number of arrows. Each of the following M lines describes an arrow with three integers A_j, B_j, C_j, separated by spaces, where A_j and B_j are the numbers of the circles (the arrow goes from circle A_j to circle B_j), and C_j is the color of the arrow.
Output
The first line of output should be "YES" if the game can be completed, and "NO" if it cannot. If the answer is "YES", the second line should contain a single number — the minimum number of moves required to finish the game.