Andrew and William are playing a game on an undirected graph with vertices, numbered from 1 to . Each vertex has a binary label, either 0 or 1. During the game, Andrew selects two vertices and (), and asks William if there exists a palindrome path from to . A palindrome path is defined as a path where the sequence of vertex labels recorded from to forms a palindrome. The path does not have to be a simple path; William can visit the same vertex multiple times.
Write a program to help William determine if such a palindrome path exists for each query.
Input Specification
The first line includes three integers, , and (), the number of vertices, the number of edges and the number of queries made by Andrew.
The second line includes a binary string with length , where the character is the label of vertex .
Each of the following lines includes two integers, and , an edge between and .
Each of the following lines includes two integers, and , a query to ask if there exists a palindrome path from to .
Output Specification
For each query, print out YES
if there exists a palindrome path, otherwise NO
.
Constraints
Subtask | Points | Additional constraints |
---|---|---|
, | ||
No additional constraints |
Sample Input
5 4 2
11101
4 5
1 3
4 2
2 5
1 5
1 3
Sample Output
NO
YES
Comments