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.
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.io.PrintStream;
            //import java.util.*;

        public class Solution {

            public static final boolean LOCAL = System.getProperty("ONLINE_JUDGE")==null;

            static class FastScanner {

                    BufferedReader br;
                    StringTokenizer st ;

                    FastScanner(){
                        br =  new BufferedReader(new InputStreamReader(System.in));
                        st = new StringTokenizer("");
                    }

                    FastScanner(String file) {

                        try {
                            br =  new BufferedReader(new InputStreamReader(new FileInputStream(file)));
                            st = new StringTokenizer("");
                        } catch (FileNotFoundException e) {
                            // TODO Auto-generated catch block
                            System.out.println("file not found");
                            e.printStackTrace();
                        }
                        
                    }
                    

                    String next() {
                        while (!st.hasMoreTokens())
                            try {
                                st = new StringTokenizer(br.readLine());
                            } catch (IOException e) {
                            }
                        return st.nextToken();
                    }

                    int nextInt() {
                        return Integer.parseInt(next());
                    }

                    long nextLong() {
                        return Long.parseLong(next());
                    }
                    String readLine() throws IOException{
                        return br.readLine();
                    }
                }
                                    
            static class Pair{
                String word;
                int cnt;
                Pair(String word,int cnt){
                    this.word = word;
                    this.cnt = cnt;
                }

            }

            

        public static void main(String[] args) throws Exception {
            
            FastScanner s = new FastScanner();

            
            if(LOCAL){
                s = new FastScanner("src/input.txt");
                PrintStream o = new PrintStream("src/sampleout.txt");
                System.setOut(o);
            }

            int tcr = s.nextInt();
         
            for(int tc=0;tc<tcr;tc++){

                String str = s.next();
             
                String t = s.next();
                
               boolean poss = false;

               int len = str.length();

               boolean dp[][] = new boolean[len][t.length()];

               for(int i=0;i<str.length();i++){
                   if(str.charAt(i) == t.charAt(t.length() - 1)){
                       dp[i][t.length()-1] = true;
                   }
               }


               for(int i=0;i<str.length();i++){
                   for(int j=t.length()-1;j>=0;j--){
                       if(str.charAt(i) == t.charAt(j)){
                           if(i>0 && j<t.length()-1){
                             dp[i][j] = dp[i-1][j+1];
                           }
                       }
                   }
               }

               //Debug.dbg(dp);


               for(int i=0;i<str.length();i++){
                   
                    int index = i;
                    int j = 0;

                    while(index < str.length() && j<t.length() &&   str.charAt(index) == t.charAt(j)){
                        
                        j++;
                        index++;

                        if(j == t.length()){
                            poss = true;
                            break;
                        }

                        if(j < t.length() && index<str.length() && dp[index][j]){
                            poss = true;break;
                        }

                        // int new_index = index-2;
                        // int new_j = j;

                        // while(new_index>=0 && new_j<t.length() && str.charAt(new_index) == t.charAt(new_j)){
                        //     new_index--;
                        //     new_j++;
                        // }

                        // if(new_j == t.length()){
                        //     poss = true;
                        //     break;
                        // }
                        
                    }



                    if(poss){break;}
               }

                System.out.println(poss?"YES":"NO");

            }
        }

        public static long gcd(long a,long b){
            if(b == 0l){
                return a;
            }

            return gcd(b,a%b);
        }

        public static int find(int parent[],int v){
            if(parent[v] == v){
                return v;
            }
            
            return parent[v] = find(parent, parent[v]);
        }

    

        public static List<Integer> sieve(){
        
            List<Integer> prime = new ArrayList<>();

            int arr[] = new int[100001];

            Arrays.fill(arr,1);

            arr[1] = 0;
            arr[2] = 1;

            for(int i=2;i<=100000;i++){
                
                if(arr[i] == 1){
                    
                    prime.add(i);

                    for(long j = (i*1l*i);j<100001;j+=i){
                        arr[(int)j] = 0;
                    }
                }
            }

            return prime;
        }

        static boolean isPower(long n,long a){
            
            long log = (long)(Math.log(n)/Math.log(a));

            long power = (long)Math.pow(a,log);

            if(power == n){return true;}

            return false;
        }


        private static int mergeAndCount(int[] arr, int l,int m, int r)
        {

            // Left subarray
            int[] left =  Arrays.copyOfRange(arr, l, m + 1);

            // Right subarray
            int[] right = Arrays.copyOfRange(arr, m + 1, r + 1);

            int i = 0, j = 0, k = l, swaps = 0;

            while (i < left.length && j < right.length) {
                if (left[i] <= right[j])
                    arr[k++] = left[i++];
                else {
                    arr[k++] = right[j++];
                    swaps += (m + 1) - (l + i);
                }
            }
            while (i < left.length)
                arr[k++] = left[i++];
            while (j < right.length)
                arr[k++] = right[j++];
            return swaps;
        }

        // Merge sort function
        private static int mergeSortAndCount(int[] arr, int l,int r)
        {

            // Keeps track of the inversion count at a
            // particular node of the recursion tree
            int count = 0;

            if (l < r) {
                int m = (l + r) / 2;

                // Total inversion count = left subarray count
                // + right subarray count + merge count

                // Left subarray count
                count += mergeSortAndCount(arr, l, m);

                // Right subarray count
                count += mergeSortAndCount(arr, m + 1, r);

                // Merge count
                count += mergeAndCount(arr, l, m, r);
            }

            return count;
        }

        static class Debug {
            //change to System.getProperty("ONLINE_JUDGE")==null; for CodeForces
            public static final boolean LOCAL = System.getProperty("ONLINE_JUDGE")==null;
            private static <T> String ts(T t) {
                if(t==null) {
                    return "null";
                }
                try {
                    return ts((Iterable) t);
                }catch(ClassCastException e) {
                    if(t instanceof int[]) {
                        String s = Arrays.toString((int[]) t);
                        return "{"+s.substring(1, s.length()-1)+"}\n";
                    }else if(t instanceof long[]) {
                        String s = Arrays.toString((long[]) t);
                        return "{"+s.substring(1, s.length()-1)+"}\n";
                    }else if(t instanceof char[]) {
                        String s = Arrays.toString((char[]) t);
                        return "{"+s.substring(1, s.length()-1)+"}\n";
                    }else if(t instanceof double[]) {
                        String s = Arrays.toString((double[]) t);
                        return "{"+s.substring(1, s.length()-1)+"}\n";
                    }else if(t instanceof boolean[]) {
                        String s = Arrays.toString((boolean[]) t);
                        return "{"+s.substring(1, s.length()-1)+"}\n";
                    }
                    try {
                        return ts((Object[]) t);
                    }catch(ClassCastException e1) {
                        return t.toString();
                    }
                }
            }
            private static <T> String ts(T[] arr) {
                StringBuilder ret = new StringBuilder();
                ret.append("{");
                boolean first = true;
                for(T t: arr) {
                    if(!first) {
                        ret.append(", ");
                    }
                    first = false;
                    ret.append(ts(t));
                }
                ret.append("}");
                return ret.toString();
            }
            private static <T> String ts(Iterable<T> iter) {
                StringBuilder ret = new StringBuilder();
                ret.append("{");
                boolean first = true;
                for(T t: iter) {
                    if(!first) {
                        ret.append(", ");
                    }
                    first = false;
                    ret.append(ts(t));
                }
                ret.append("}");
                return ret.toString();
            }
            public static void dbg(Object... o) throws Exception {
                if(LOCAL) {
                    PrintStream ps = new PrintStream("src/Debug.txt");
                    System.setErr(ps);
                    System.err.print("Line #"+Thread.currentThread().getStackTrace()[2].getLineNumber()+": [");
                    for(int i = 0; i<o.length; i++) {
                        if(i!=0) {
                            System.err.print(", ");
                        }
                        System.err.print(ts(o[i]));
                    }
                    System.err.println("]");
                }
            }
        }

}
