#SGM0000018. Kiểm tra dãy ngoặc (Parenthesis Checking)
Kiểm tra dãy ngoặc (Parenthesis Checking)
Parenthesis Checking
Source: AtCoder
Version: Phuoc Hung OJ Extended
You are given a string of length consisting only of ( and ). Process queries:
1 l r: swap the characters at positions and .2 l r: determine whether the contiguous substring is a correct parenthesis sequence.
A correct parenthesis sequence has total balance , and while scanning left to right, its balance never becomes negative.
Input
The first line contains .
The second line contains .
The next lines contain queries. It is guaranteed that and at least one type 2 query exists.
Output
For every type 2 query, print Yes if the substring is correct and No otherwise.
Subtasks
- Subtask 1 — 20%: .
- Subtask 2 — 30%: .
- Subtask 3 — 50%: .
Examples
Input
5 3
(())(
2 1 4
2 1 2
2 4 5
Output
Yes
No
No
Explanation
The sample follows the operations exactly; each printed line corresponds to a query that requires output.