You are given a string consisting of the brackets "<",">"; "(",")"; "{","}"; "[","]" and a series of N pairs of integers "i j" (1 ≤ i ≤ j ≤ 10^6)
The problem is to determine if a subsequence is a right bracket sequence (RBS)
Here is a definition of RBS: RBS + RBS = RBS; <RBS> = RBS, (RBS) = RBS, [RBS] = RBS, {RBS} = RBS.
The following sequences are RBS: (), ([]), <>()[](<>){{}}, <{{{}}()}>.
Input Sequence of brackets. The length of the sequence does not exceed 106.
N — the number of requests, N ≤ 2*10^6.
N lines with pairs of i and j.
Output N lines with answers: "Y" when subsequence is a RBS, "N" otherwise
Input#1
}<>(){)(<})[]
3
2 3
2 5
8 11
Output#1
Y
Y
N
Input#2
((><))>{<>}[[])
5
2 5
8 11
12 13
12 14
13 14
Output#2
N
Y
N
N
Y
Limita de timp : 3 secunde
Limita de memorie : 64 Mb
sper ca nu are nimic faptul ca am lasat problema in engleza ... nu cred ca vor fi probleme vand in vedere ca suntem .. programatori

edit : unde se mai vede 106 in cod ii 10 la puterea a 6-a
& cred ca 2 saptamani e bin ... cred ca acelas termen lar da si tw8