Mr.Frog likes to use a music player called “NetEase Cloud Music”. There are N songs in the music library of “NetEase Cloud Music”. We use the string Si to indicate the melody of the ith song. The duration of the ith song is |Si| seconds. The phoneme of the ith song at jth second is Si,j. There are 26 types of phoneme, and we use lowercase ‘a’-‘z’ to represent them. Each phoneme appears at most once in the same song. Every day, Mr.Frog can choose exactly one song from the music library, then he will start playing this song in the single tune circulation mode. One day, he wants to listen a special melody “fabc”. If he chooses a song “abcdef”, he will listen the melody “abcdefabcdefab... ...”. So, he can listen the special melody from 6th second to 9th second. In the next Q days, Mr.Frog hopes to listen a special melody Mi at the ith day. Please tell him whether he can listen this melody.
Mr.Frog likes to use a music player called “NetEase Cloud Music”. There are N songs in the music library of “NetEase Cloud Music”. We use the string Si to indicate the melody of the ith song. The duration of the ith song is |Si| seconds. The phoneme of the ith song at jth second(j ∈ [1,|Si|]) is Si,j. There are 26 types of phoneme, and we use lowercase ‘a’-‘z’ to represent them. Each phoneme appears at most once in the same song. Every day, Mr.Frog can choose exactly one song from the music library, then he will start playing this song in the single tune circulation mode. One day, he wants to listen a special melody “fabc”. If he chooses a song “abcdef”, he will listen the melody “abcdefabcdefab... ...”. So, he can listen the special melody from 6th second to 9th second. In the next Q days, Mr.Frog hopes to listen a special melody Mi at the ith day. Please tell him whether he can listen this melody.