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.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigInteger;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.math.BigInteger;
import java.util.List;
import java.util.Map;



import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;

public class lk
{	
	public static int count=0;
	static class ListNode {
	   
    int data;
    ListNode next;
    public ListNode(int d)
    {
        data = d;
        next = null;
    }
}

static class linkedList{
	ListNode head;
	ListNode tail;
	int length;
	public linkedList()
	{
		head=null;
		tail=null;
		length=0;
	}
	void insert(ListNode node)
	{
		length++;
		if(tail==null)
		{
			head=node;
			tail=node;
		}
		else
		{
			tail.next=node;
			tail=tail.next;
		}
	}
	void deleteNext()
	{
		length--;
	}
	int delete(int ind)
	{
		if(head==null)return -1;
		int p=1;
		ListNode prev=null;
		ListNode k=head;
		int val=-1;
		while(k!=null && p<=ind)
		{
			if(p==ind)
			{
				length--;
				val=k.data;
				if(k.next==null)
				{
					if(prev!=null)
					{
					//System.out.println("sasa");
					prev.next=null;
					tail=prev;
					}
					else
					{
						tail=null;
						head=null;
					}
				}
				else
				{
					if(prev==null)
					{
						head=k.next;
						
					}
					else
					{
					prev.next=k.next;
					}
					
				}
				
			}
			prev=k;
			k=k.next;
			p++;
			
		}
		
			return val;
		

	}
	void print ()
	{
		ListNode k=head;
		while(k!=null)
		{
			System.out.print(k.data+"  ");
			k=k.next;
		}
		//System.out.print(k.data+"  ");
		System.out.println();
		
	}
}
	 static class Reader {
		 
	        final private int BUFFER_SIZE = 1 << 16;
	        private DataInputStream din;
	        private byte[] buffer;
	        private int bufferPointer, bytesRead;
	 
	        public Reader()
	        {
	            din = new DataInputStream(System.in);
	            buffer = new byte[BUFFER_SIZE];
	            bufferPointer = bytesRead = 0;
	        }
	 
	        public Reader(String file_name) throws IOException
	        {
	            din = new DataInputStream(
	                new FileInputStream(file_name));
	            buffer = new byte[BUFFER_SIZE];
	            bufferPointer = bytesRead = 0;
	        }
	 
	        public String readLine() throws IOException
	        {
	            byte[] buf = new byte[64]; // line length
	            int cnt = 0, c;
	            while ((c = read()) != -1) {
	                if (c == '\n') {
	                    if (cnt != 0) {
	                        break;
	                    }
	                    else {
	                        continue;
	                    }
	                }
	                buf[cnt++] = (byte)c;
	            }
	            return new String(buf, 0, cnt);
	        }
	 
	        public int nextInt() throws IOException
	        {
	            int ret = 0;
	            byte c = read();
	            while (c <= ' ') {
	                c = read();
	            }
	            boolean neg = (c == '-');
	            if (neg)
	                c = read();
	            do {
	                ret = ret * 10 + c - '0';
	            } while ((c = read()) >= '0' && c <= '9');
	 
	            if (neg)
	                return -ret;
	            return ret;
	        }
	 
	        public long nextLong() throws IOException
	        {
	            long ret = 0;
	            byte c = read();
	            while (c <= ' ')
	                c = read();
	            boolean neg = (c == '-');
	            if (neg)
	                c = read();
	            do {
	                ret = ret * 10 + c - '0';
	            } while ((c = read()) >= '0' && c <= '9');
	            if (neg)
	                return -ret;
	            return ret;
	        }
	 
	        public double nextDouble() throws IOException
	        {
	            double ret = 0, div = 1;
	            byte c = read();
	            while (c <= ' ')
	                c = read();
	            boolean neg = (c == '-');
	            if (neg)
	                c = read();
	 
	            do {
	                ret = ret * 10 + c - '0';
	            } while ((c = read()) >= '0' && c <= '9');
	 
	            if (c == '.') {
	                while ((c = read()) >= '0' && c <= '9') {
	                    ret += (c - '0') / (div *= 10);
	                }
	            }
	 
	            if (neg)
	                return -ret;
	            return ret;
	        }
	 
	        private void fillBuffer() throws IOException
	        {
	            bytesRead = din.read(buffer, bufferPointer = 0,
	                                 BUFFER_SIZE);
	            if (bytesRead == -1)
	                buffer[0] = -1;
	        }
	 
	        private byte read() throws IOException
	        {
	            if (bufferPointer == bytesRead)
	                fillBuffer();
	            return buffer[bufferPointer++];
	        }
	 
	        public void close() throws IOException
	        {
	            if (din == null)
	                return;
	            din.close();
	        }
	 }
	 public static long gcd(long x, long p)
	    {
	        if (x == 0)
	            return p;
	         
	        return gcd(p%x, x);
	    }
	
	 static int setBitNumber(int n)
	    {
	 
	        // To find the position of the
	        // most significant set bit
	        int k = (int)(Math.log(n) / Math.log(2));
	 
	        // To return the the value of the number
	        // with set bit at k-th position
	       return k;
	    }
	 
	
	 public ListNode insertionSortList(ListNode head) {
		if (head == null || head.next == null) return head; 
		ListNode sorted = new ListNode(0); 

		ListNode unsorted = head, inserted; 
		while (unsorted != null) {
			inserted = unsorted; 
			unsorted = unsorted.next;  
			insert(sorted, inserted);
		}

		return sorted.next; 
	}
	private void insert(ListNode sorted, ListNode inserted) {
		ListNode curr = sorted.next, prev = sorted;
		while (prev != null) {
			if (curr == null || curr.data >= inserted.data) {
				prev.next = inserted;
				inserted.next = curr;
				break;
			}
			prev = curr; 
			curr = curr.next; 
		}
	}

	
		public static void main(String args[]) throws NumberFormatException, IOException ,java.lang.Exception
	{
		
		//Reader reader = new Reader();
		//Scanner reader=new Scanner(System.in);
		//BufferedWriter output = new BufferedWriter(new OutputStreamWriter(System.out));
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int cases=Integer.parseInt(br.readLine());
		//int cases=1;	
		//int cases=reader.nextInt();
		
   	while (cases-->0){
   		
   		String s=br.readLine();
   		String t=br.readLine();
   		int ind=0;
   		char x=t.charAt(0);
   		boolean yes=false;
   		for(int i=0;i<s.length();i++)
   		{
   			if(x==s.charAt(i))
   			{
   				String k="";
   				
   					int Tind=0;
   					int j=i;
   					while(j<s.length()&&Tind<t.length() && s.charAt(j)==t.charAt(Tind))
   					{
   						k=k+s.charAt(j);
   						if(k.equals(t))
   						{
   							yes=true;
   							break;
   						}
   						int left=t.length()-Tind-1;
   						if(j-left>=0 && j>0 && Tind+1!=t.length() && t.charAt(Tind+1)==s.charAt(j-1))
   						{
   							
   						 StringBuilder input1 = new StringBuilder();
   						 
   				        // append a string into StringBuilder input1
   				        input1.append(s.substring(j-left,j));
   				// System.out.println(input1 + "  " +j+ " "+left+" "+(j-left)+" "+s.substring(j-left,left));
   				        // reverse StringBuilder input1
   				        input1.reverse();
   				     String q=k+input1;
						//System.out.println(q);
   							if(q.equals(t))
   							{
   								yes=true;
   								break;
   							}
   						}
   						j++;
   						Tind++;
   					}
   				
   				if(yes)break;
   			}
   			if(yes)break;
   		}
   		
		if(yes)System.out.println("YES");
		else System.out.println("NO");
		
		
   		
   	}}
   	}	
   		
