#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
using namespace std;
const int N = 100005;
char s[15];
string s1 , s2 ;
bool f(int x)
{
int ans = 0 ;
int i = 0 ;
while(s1[x] == s2[i] && x < s1.size() && i < s2.size())
{
x ++ , i ++ ;
ans ++ ;
}
if(ans == s2.size()) return true;
x -= 2 ;
while(s1[x] == s2[i] && x >= 0 && i < s2.size())
{
x -- , i ++ ;
ans ++ ;
}
if(ans == s2.size()) return true;
}
void solve()
{
cin >> s1 >> s2 ;
int cnt = 0 ;
for(int i = 0 ; i < s1.size() ; i ++ )
{
if(s1[i] == s2[0])
{
if(f(i)) cnt = 1 ;
}
}
if(cnt > 0 ) printf("YES\n");
else printf("NO\n");
}
int main()
{
int t ;
cin >> t ;
while( t -- )
{
solve();
}
return 0 ;
}