G. Multiples of 5
time limit per test
1 second
memory limit per test
1024 megabytes
input
standard input
output
standard output

Given a non-negative base-$$$11$$$ integer with a length less than $$$10^{14}$$$, determine if it is a multiple of $$$5$$$.

Due to the large input size, the input is given in the form of $$$n$$$ pairs $$$(a_i, b_i)$$$ , where each pair $$$(a_i, b_i)$$$, represents $$$a_i$$$ consecutive digits all being $$$b_i$$$. Concatenating all pairs in order gives the input number.

Here we use the digits 0,1,2,$$$\dots$$$,9 and the letter A to represent the base-$$$11$$$ numeral system.

For example, the input $$$(1, \texttt{1}),(4, \texttt{5}),(1, \texttt{4})$$$ represents the number $$$(155554)_{11}$$$. Specifically, the decimal number $$$110$$$ corresponds to the input $$$(1, \texttt{A}),(1, \texttt{0})$$$.

Input

The first line contains a single integer $$$T$$$ ($$$1 \le T \le 10^3$$$), representing the number of test cases. For each test case:

The first line contains a positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$).

The next $$$n$$$ lines each contain a positive integer $$$a_i$$$ ($$$1 \le a_i \le 10^9$$$) and a character $$$b_i$$$ ($$$b_i \in \{\texttt{0},\texttt{1},\texttt{2},\dots,\texttt{9},\texttt{A}\}$$$) representing the $$$i$$$-th pair.

It's guaranteed that the sum of $$$n$$$ over all the test cases will not exceed $$$10^5$$$.

Note that the data does NOT guarantee no leading zeros.

Output

Output $$$T$$$ lines, the $$$i$$$-th line representing the answer for the $$$i$$$-th test case. For each test case:

Output "Yes" if the given base-$$$11$$$ number is a multiple of $$$5$$$, otherwise, output "No".

Case insensitive, no quotes in the output.

Example
Input
3
3
1 1
4 5
1 4
3
1 9
19 8
1 0
1
100 A
Output
Yes
No
Yes