## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## [Solution] Linguistics Codeforces Solution | Codeforces Problem Solution 2022

D. Linguistics
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Alina has discovered a weird language, which contains only $4$ words: $\mathtt{\text{A}}$$\mathtt{\text{B}}$$\mathtt{\text{AB}}$$\mathtt{\text{BA}}$. It also turned out that there are no spaces in this language: a sentence is written by just concatenating its words into a single string.

Alina has found one such sentence $s$ and she is curious: is it possible that it consists of precisely $a$ words $\mathtt{\text{A}}$$b$ words $\mathtt{\text{B}}$$c$ words $\mathtt{\text{AB}}$, and $d$ words $\mathtt{\text{BA}}$?

In other words, determine, if it's possible to concatenate these $a+b+c+d$ words in some order so that the

resulting string is $s$. Each of the $a+b+c+d$ words must be used exactly once in the concatenation, but you can choose the order in which they are concatenated.

Input

The first line of the input contains a single integer $t$ ($1\le t\le {10}^{5}$) — the number of test cases. The description of the test cases follows.

The first line of each test case contains four integers $a$$b$$c$$d$ ($0\le a,b,c,d\le 2\cdot {10}^{5}$) — the number of times that words $\mathtt{\text{A}}$$\mathtt{\text{B}}$$\mathtt{\text{AB}}$$\mathtt{\text{BA}}$ respectively must be used in the sentence.

The second line contains the string $s$ ($s$ consists only of the characters $\mathtt{\text{A}}$ and $\mathtt{\text{B}}$$1\le |s|\le 2\cdot {10}^{5}$$|s|=a+b+2c+2d$)  — the sentence. Notice that the condition $|s|=a+b+2c+2d$ (here $|s|$ denotes the length of the string $s$) is equivalent to the fact that $s$ is as long as the concatenation of the $a+b+c+d$ words.

The sum of the lengths of $s$ over all test cases doesn't exceed $2\cdot {10}^{5}$.

Output

For each test case output $\mathtt{\text{YES}}$ if it is possible that the sentence $s$ consists of precisely $a$ words $\mathtt{\text{A}}$$b$ words $\mathtt{\text{B}}$$c$ words $\mathtt{\text{AB}}$, and $d$ words $\mathtt{\text{BA}}$, and $\mathtt{\text{NO}}$ otherwise. You can output each letter in any case.