You have a string s and a chip, which you can place onto any character of this string. 

After placing the chip, you move it to the right several (maybe zero) times, i. e. you perform the following operation several times: if the current position of the chip is i, you move it to the position i + 1. Of course, moving the chip to the right is impossible if it is already in the last position.

After moving the chip to the right, you move it to the left several (maybe zero) times, i. e. you perform the following operation several times: if the current position of the chip is i, you move it to the position i - 1. Of course, moving the chip to the left is impossible if it is already in the first position.

When you place a chip or move it, you write down the character where the chip ends up after your action. For example, if s is abcdef, you place the chip onto the 3-rd character, move it to the right 2 times and then move it to the left 3 times, you write down the string cdedcb.

You are given two strings s and t. Your task is to determine whether it's possible to perform the described operations with s so that you write down the string t as a result.

Input

The first line contains one integer q (1 ≤ q ≤ 500) — the number of test cases.

Each test case consists of two lines. The first line contains the string s (1 ≤ |s| ≤ 500), the second line contains the string t (1 ≤ |t| ≤ 2 ⋅ |s| - 1). Both strings consist of lowercase English characters.

It is guaranteed that the sum of |s| over all test cases does not exceed 500.

Output

For each test case, print "YES" if you can obtain the string t by performing the process mentioned in the statement with the string s, or "NO" if you cannot.

You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer).

Example

Input


6
abcdef
cdedcb
aaa
aaaaa
aab
baaa
ab
b
abcdef
abcdef
ba
baa


Output


YES
YES
NO
YES
YES
NO

Note

Consider the examples.

The first test case is described in the statement.

In the second test case, you can place the chip on the 1-st position, move it twice to the right, and then move it twice to the left.

In the fourth test case, you can place the chip on the 2-nd position, and then don't move it at all.

In the fifth test case, you can place the chip on the 1-st position, move it 5 times to the right, and then finish the process.
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define lli long long int
typedef tree<pair<lli, lli>, null_type, less<pair<lli, lli>>, rb_tree_tag, tree_order_statistics_node_update> omultiset; // store ind on sec
typedef tree<lli, null_type, less<lli>, rb_tree_tag, tree_order_statistics_node_update> oset;
typedef tree<lli, null_type, greater<lli>, rb_tree_tag, tree_order_statistics_node_update> oset1; // decreasing
typedef tree<pair<lli, lli>, null_type, greater<pair<lli, lli>>, rb_tree_tag, tree_order_statistics_node_update> omultiset1;
/*  member functions :
                1. order_of_key(k) : number of elements strictly lesser than k
                2. find_by_order(k) : k-th element in the set (counting from zero)     */
#define inf 1e18
#define fio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define bpc               __builtin_popcount
#define rep(i,a,b)        for(lli i=a;i<b;i++)
#define per(i,a,b)        for(lli i=a;i>=b;i--)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define fi                first
#define se                second
#define sz(x)             (int)((x).size())
#define all(x)            (x).begin(),(x).end()
#define alr(s)            s.rbegin(),s.rend()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define vi vector<lli>
#define vpi vector<pair<lli,lli>>
#define pi pair<lli,lli>
#define vppi vector<pair<pair<lli,lli>,lli>>
#define pq_max priority_queue<lli>
#define pqp_max priority_queue<pi>
#define pq_min priority_queue<lli, vector<lli>, greater<lli> >
#define pqp_min priority_queue<pi, vector<pi>, greater<pi> >
#define mod             1000000007
#define m_pi              3.141592653589793238
//vector<bool> prime(200000000,true);
//vector<pair<pair<lli, lli>,lli> > st;
//map<lli,lli> np;
//queue<lli> qy;
lli gcd(lli a, lli b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
lli is_power_of_two(int a)
{
    return a && (!(a & (a - 1)));
}
/*lli fast_mod_exp(lli a, lli b, lli m) {
    lli res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a) % m;

        a = (a * a) % m;
        b = b >> 1;
    }

    return res;
}

lli mod_inverse(lli a, lli m) {
    return fast_mod_exp(a, m - 2, m);
}
lli ncr(lli n, lli r, lli p) {
    if (r == 0)
        return 1;
    if(r>n)
        return 0;

    return ((fact[n] * mod_inverse(fact[n - r], p)) % p * mod_inverse(fact[r], p)) % p;
}*/
bool isSquare(lli x)
{
    lli y = sqrt(x);
    return y * y == x;
}
/*void sieve()
{



    for (int p = 2; p * p <= 2e8; p++)
    {

        if (prime[p] == true)
        {

            for (int i = p * p; i <= 2e8; i += p)
                prime[i] = false;
        }
    }

}*/

lli power(lli x, lli n, lli m)
{
    lli result, y;
    if(x == 0)
        return 0;
    if(n == 0)
        return 1;
    y = power(x, n / 2, m);
    result = (y * y) % m;
    if(n % 2 == 1)
        result = (result * x) % m;
    return result;
}
lli leftmostsetbit(lli n)
{
    lli k = (int)(log2(n));
    return k;
}
lli rightmostsetbit(lli n)
{
    return log2(n & (~(n - 1)));
}
lli dx[4] = {1, 0, 0, -1}, dy[4] = {0, -1, 1, 0}; //DLRU..lexographic
//..................................../
/*lli a[N],seg[2*N];
void build(lli idx,lli low,lli high){
    if(low==high){
        seg[idx]=a[low];
        return;
    }
    lli mid=(low+high)/2;
    build(2*idx+1,low,mid);
    build(2*idx+2,mid+1,high);
    seg[idx] = (seg[2*idx+1]+seg[2*idx+2]);
}
lli query(lli idx,lli low,lli high,lli l,lli r){
    if(low>=l&&high<=r){
        return seg[idx];
    }
    if(high<l||low>r){
        return 0;
    }
    lli mid=(low+high)>>1;
    lli left = query(2*idx+1,low,mid,l,r);
    lli right = query(2*idx+2,mid+1,high,l,r);
    return (left+right);
}
void update(lli idx,lli low,lli high,lli node,lli val){
    if(low==high){
        seg[idx]=val;
        return;
    }
    lli mid = (low+high)>>1;
    if(node<=mid&&node>=low) update(2*idx+1,low,mid,node,val);
    else update(2*idx+2,mid+1,high,node,val);
    seg[idx]=seg[2*idx+1]+seg[2*idx+2];

}*/
lli lcm(lli a,lli b)
{
    return (1ll*a*b)/gcd(a,b);
}
void solve()
{
    string s,t;
    cin>>s>>t;
    lli n  =s.length();
    vector<lli> v;
    for(lli i=0;i<s.length();i++)
    {
        if(s[i]==t[0]) v.pb(i);
    }
    for(lli i=0;i<v.size();i++)
    {
        lli x = v[i] , y = 1;
        bool f = false;
        while(x+1<n&&s[x+1]==t[y])
        {
            x++;
            y++;
        }
        while(x-1>=0&&s[x-1]==t[y])
        {
            x--;
            y++;
        }
        if(y==t.length())
        {
            cout<<"YES"<<endl;
            return;
        }
    }
    cout<<"NO"<<endl;
}
int main()
{
    fio;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    lli t = 1;
    cin>>t;
    while(t--)
    {
        solve();
        //cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    }
}