#ABC477C. 区间查找询问 / Range Search Query

区间查找询问 / Range Search Query

Problem Statement

You are given strings SS and TT. Process QQ queries. In each query, you are given LL and RR. Determine whether the substring of SS consisting of the LL-th through RR-th characters contains TT as a substring.

What is a substring? A substring of SS is a string obtained by deleting zero or more characters from the beginning and zero or more characters from the end of SS. For example, ab is a substring of abc, but ac is not a substring of abc.

Constraints

  • SS is a string of length between 11 and 4×1054 \times 10^5, inclusive, consisting of lowercase English letters.
  • TT is a string of length between 11 and 1010, inclusive, consisting of lowercase English letters.
  • 1≤Q≤2×1051 \leq Q \leq 2 \times 10^5
  • 1≤L≤R≤∣S∣1 \leq L \leq R \leq |S|
  • Q,L,RQ, L, R are integers.

Input

The input is given from Standard Input in the following format:

  • QQ
  • SS
  • TT
  • query1\mathrm{query}_1
  • query2\mathrm{query}_2
  • ⋮\vdots
  • queryQ\mathrm{query}_Q

Each query queryq\mathrm{query}_q is given in the following format:

  • LL RR

Output

Output QQ lines. The qq-th line should contain Yes if, for the qq-th query, the substring of SS consisting of the LL-th through RR-th characters contains TT as a substring, and No otherwise.

3
abcdabc
bc
2 6
3 5
3 7
Yes
No
Yes

Consider the first query. The substring of SS consisting of the 22-nd through 66-th characters is bcdab. The substring of bcdab consisting of the 11-st through 22-nd characters matches TT, so bcdab contains TT. Thus, the answer is Yes.

10
bbbaaabbbaaaaaabbbab
bbb
5 16
5 6
2 16
6 7
17 19
3 7
7 16
7 20
17 19
2 6
Yes
No
Yes
No
No
No
Yes
Yes
No
No