# Watercolor shefin BSMRSTU Practice contest...
Limits 2s, 256 MB

Bob is the owner of a shop named "Color Maker". He has 256 types of watercolor in his shop. The types are numbered from 0 to 255. Bob stores the watercolors in small boxes. One box contains only one type of watercolor and there can be more than one box containing the same type of watercolor. Bob keeps the boxes on a shelf side by side. As he has a limited supply of watercolors, he sells the boxes of watercolors with a condition applied.

Bob arranges another set of sample boxes containing watercolors and keeps them on another shelf side by side. He does not sell these sample boxes.

After that, Bob numbers the boxes. Let the number of boxes on the first shelf is $N$ and the number of the sample boxes is $M$. Then Bob numbers the boxes on the first shelf from 1 to $N$ and the sample boxes from 1 to $M$.

When Alice wants to buy watercolors in this shop, Bob asks her to choose a box. If she chooses the $k$-th box, Bob finds out a position $j$ in the sample boxes and the number of boxes $p$ such that:

$B_k = S_j$, $B_{k+1} = S_{j+1}$, $B_{k+2} = S_{j+2}$, ..., $B_{k+p-1} = S_{j+p-1}$, where $B_i$ represents the $i$-th box on the first shelf, $S_i$ represents the $i$-th box of the sample boxes and $k ≥ 1$, $k+p-1 ≤ N$, $j ≥ 1$ and $j+p-1 ≤ M$. Bob then sells $p$ boxes to Alice.

Surprisingly, Bob notices that there can be multiple ways and multiple values of $p$ possible. Alice demands that among the ways, he has to choose the way in which the value of $p$ is maximized and has to sell $p$ boxes. Since calculating the maximum possible value of p is tough for Alice, she asks you to calculate this on behalf of her.

## Input

The first line of the input contains two integers $N$ ($1 ≤ N ≤ 10^6$), $M$ ($1 ≤ M ≤ 10^3$) - the number of boxes on the first shelf and the number of the sample boxes.

The second line contains $N$ space-separated integers. the $i$-th integer represents the type of the watercolor $i$-th box contains.

The third line contains $M$ space-separated integers. the $i$-th integer represents the type of the watercolor $i$-th sample box contains.

The next line contains an integer $Q$ ($1 ≤ Q ≤ 10^6$), the number of the queries. In each of the next $Q$ lines, there will be an integer $k$ ($1 ≤ k ≤ N$), the position of the box Alice chooses.

Other Constraints:

• $0 ≤ \text{Types of Watercolor} ≤ 255$

## Output

For each query, print in this format in a single line (without quotes): "Query x: y", where $x$ is the number of the query and $y$ is the maximum possible value of $p$ described in the statement.

## Sample

InputOutput
6 5
14 25 90 14 81 12
14 14 81 12 0
3
5
2
4

Query 1: 2
Query 2: 0
Query 3: 3


In the third Query, Alice chooses the $4^{th}$ box. So, $k = 4$. To maximize the value of $p$, the best way is to select the position 2 in the sample boxes. So, $j = 2$. Thus, $B_4 = S_2$, $B_5 = S_3$, $B_6 = S_4$. Here, $B_4 = 14$, $B_5 = 81$, $B_6 = 12$ and $S_2 = 14$, $S_3 = 81$, $S_4 = 12$. As 3 boxes are matched in this way, the value of $p$ is 3 here and its the maximum among other ways. $B$ represents the boxes on the first shelf, $S$ represents the sample boxes. ### Submit
{"ft_lang_label":"__label__en","ft_lang_prob":0.89644736,"math_prob":0.9997855,"size":2647,"snap":"2022-40-2023-06","text_gpt3_token_len":631,"char_repetition_ratio":0.16950434,"word_repetition_ratio":0.079766534,"special_character_ratio":0.25198337,"punctuation_ratio":0.13787085,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99982053,"pos_list":[0,1,2,3,4,5,6,7,8],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-10-03T03:59:48Z\",\"WARC-Record-ID\":\"<urn:uuid:f82a0b38-17db-425f-afe5-393205f7dfe5>\",\"Content-Length\":\"80591\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:f22ca2f5-f332-4199-93c9-e8f644495b51>\",\"WARC-Concurrent-To\":\"<urn:uuid:89fa8aaa-7f0b-4aa1-8b5b-1e2e2584ede8>\",\"WARC-IP-Address\":\"172.104.160.52\",\"WARC-Target-URI\":\"https://toph.co/p/watercolor\",\"WARC-Payload-Digest\":\"sha1:B44XVPQY2UAVFYTD5RDBS2NGT6KXCHIE\",\"WARC-Block-Digest\":\"sha1:WBUXDUK2JNHKWZ6WK2X3FN63UFR4VMLA\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-40/CC-MAIN-2022-40_segments_1664030337398.52_warc_CC-MAIN-20221003035124-20221003065124-00227.warc.gz\"}"}