description: 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.
solution: import java.io.OutputStream;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.PrintWriter;
  import java.io.BufferedReader;
  import java.io.InputStreamReader;
  import java.util.*;
  
  public class Main {
      public static void main(String[] args){
          InputStream inputStream = System.in;
          OutputStream outputStream = System.out;
          InputReader in = new InputReader(inputStream);
          PrintWriter out = new PrintWriter(outputStream);
          solve(in, out);
          out.close();
      }
  
      static String reverse(String s) {
          return (new StringBuilder(s)).reverse().toString();
      }
  
      static void sieveOfEratosthenes(int n, int factors[], ArrayList<Integer> ar) 
      { 
          factors[1]=1;
          int p;
          for(p = 2; p*p <=n; p++) 
          { 
              if(factors[p] == 0) 
              { 
                  ar.add(p);
                  factors[p]=p;
                  for(int i = p*p; i <= n; i += p) 
                      if(factors[i]==0)
                          factors[i] = p; 
              } 
          } 
          for(;p<=n;p++){
              if(factors[p] == 0) 
              { 
                  factors[p] = p;
                  ar.add(p);
              } 
          }
      }
  
      static void sort(int ar[]) {
          int n = ar.length;
          ArrayList<Integer> a = new ArrayList<>();
          for (int i = 0; i < n; i++)
              a.add(ar[i]);
          Collections.sort(a);
          for (int i = 0; i < n; i++)
              ar[i] = a.get(i);
      }
  
      static void sort1(long ar[]) {
          int n = ar.length;
          ArrayList<Long> a = new ArrayList<>();
          for (int i = 0; i < n; i++)
              a.add(ar[i]);
          Collections.sort(a);
          for (int i = 0; i < n; i++)
              ar[i] = a.get(i);
      }
  
      static void sort2(char ar[]) {
          int n = ar.length;
          ArrayList<Character> a = new ArrayList<>();
          for (int i = 0; i < n; i++)
              a.add(ar[i]);
          Collections.sort(a);
          for (int i = 0; i < n; i++)
              ar[i] = a.get(i);
      }
  
      static long ncr(long n, long r, long mod) {
          if (r == 0)
              return 1;
          long val = ncr(n - 1, r - 1, mod);
          val = (n * val) % mod;
          val = (val * modInverse(r, mod)) % mod;
          return val;
      }
  
      static void build(int t1[], int a[], int v, int tl, int tr) {
          if (tl == tr) {
              t1[v] = a[tl];
          } else {
              int tm = (tl + tr) / 2;
              build(t1, a, v*2, tl, tm);
              build(t1, a, v*2+1, tm+1, tr);
              t1[v] = 0;
          }
      }
  
      static void update(int t1[], int v, int tl, int tr, int x, int new_val) {
          // if (tl > tr) 
          //     return;
          t1[v] = Math.max(new_val,t1[v]);
          if(tl==tr)
              return;
          int tm = (tl + tr) / 2;
          if(x<=tm)
              update(t1, v*2, tl, tm, x, new_val);
          else
              update(t1, v*2+1, tm+1, tr, x, new_val);
      }
  
      static int get(int t1[], int v, int tl, int tr, int l, int r) {
          if (tl >= l && tr <= r) {
              return t1[v];
          }
          int tm = (tl + tr) / 2;
          int max = 0;
          if(l<=tm)
              max = Math.max(get(t1, v*2, tl, tm, l, r),max);
          if(r>=tm+1)
              max = Math.max(get(t1, v*2+1, tm+1, tr, l, r), max);
          return max;
      }
  
      public static void solve(InputReader sc, PrintWriter pw){
          int i, j = 0;
          // int t = 1; 
          long mod = 1000000007;
          int t = sc.nextInt();
          u: while (t-- > 0) {
              char ch[] = sc.next().toCharArray();
              char ch1[] = sc.next().toCharArray();
              int n = ch.length;
              int m = ch1.length;
              for(i=0;i<n;i++){
                  x:for(j=i;j<n;j++){
                      int c = 0;
                      for(int k=i;k<=j;k++){
                          if(ch1[c++]!=ch[k]){
                              continue x;
                          }
                          if(c==m){
                              pw.println("YES");
                              continue u;
                          }
                      }
                      for(int k=j-1;k>=0;k--){
                          if(ch1[c++]!=ch[k]){
                              continue x;
                          }
                          if(c==m){
                              pw.println("YES");
                              continue u;
                          }
                      }
                  }
              }
              pw.println("NO");
          }
      }
  
      static void findPrimes(int num, HashMap<Integer, Integer> pos, ArrayList<Integer> ar){
          for(int i=2;i*i<num;i++){
              if(num%i==0){
                  while(num%i==0){
                      num/=i;
                  }
                  if(pos.containsKey(i))
                      continue;
                  ar.add(i);
                  pos.put(i,ar.size()-1);
              }
          }
          if(num>1){
              if(!pos.containsKey(num)){
                  ar.add(num);
                  pos.put(num,ar.size()-1);
              }
          }
      }
  
      static long[][] matrixMult(long a[][], long b[][], long mod){
          int n = a.length;
          int m = a[0].length;
          int p = b[0].length;
          long c[][] = new long[n][p];
          for(int i=0;i<n;i++){
              for(int j=0;j<m;j++){
                  for(int k=0;k<p;k++){
                      c[i][k] += a[i][j]*b[j][k];
                      c[i][k] %= mod;
                  }
              }
          }
          return c;
      }
  
      static long[][] exp(long mat[][], long b, long mod){
          if(b==0){
              int n = mat.length;
              long res[][] = new long[n][n];
              for(int i=0;i<n;i++){
                  res[i][i] = 1;
              }
              return res;
          }
          long half[][] = exp(mat, b/2, mod);
          long res[][] = matrixMult(half, half, mod);
          if(b%2==1){
              res = matrixMult(res, mat, mod);
          }
          return res;
      }
  
      static void countPrimeFactors(int num, int a[], HashMap<Integer,Integer> pos){
          for(int i=2;i*i<num;i++){
              if(num%i==0){
                  int y = pos.get(i);
                  while(num%i==0){
                      a[y]++;
                      num/=i;
                  }
              }
          }
          if(num>1){
              int y = pos.get(num);
              a[y]++;
          }
      }
  
      static void assignAnc(ArrayList<Integer> ar[], int depth[], int sz[], int par[][] ,int curr, int parent, int d){
          depth[curr] = d;
          sz[curr] = 1;
          par[curr][0] = parent;
          for(int v:ar[curr]){
              if(parent==v)
                  continue;
              assignAnc(ar, depth, sz, par, v, curr, d+1);
              sz[curr] += sz[v];
          }
      }
  
      static int findLCA(int a, int b, int par[][], int depth[]){
          if(depth[a]>depth[b]){
              a = a^b;
              b = a^b;
              a = a^b;
          }
          int diff = depth[b] - depth[a];
          for(int i=19;i>=0;i--){
              if((diff&(1<<i))>0){
                  b = par[b][i];
              }
          }
          if(a==b)
              return a;
          for(int i=19;i>=0;i--){
              if(par[b][i]!=par[a][i]){
                  b = par[b][i];
                  a = par[a][i];
              }
          }
          return par[a][0];
      }
  
      static void formArrayForBinaryLifting(int n, int par[][]){
          for(int j=1;j<20;j++){
              for(int i=0;i<n;i++){
                  if(par[i][j-1]==-1)
                      continue;
                  par[i][j] = par[par[i][j-1]][j-1];
              }
          }
      }
  
      static long lcm(int a, int b){
          return a*b/gcd(a,b);
      }
  
      static class Pair1 {
          long a;
          long b;
          
          Pair1(long a, long b) {
              this.a = a;
              this.b = b;
          }
      }
  
      static class Pair implements Comparable<Pair> {
          int a;
          int b;
          // int c;
          
          Pair(int a, int b) {
              this.a = a;
              this.b = b;
              // this.c = c;
          }
   
          public int compareTo(Pair p) {
              if(a!=p.a)
                  return a-p.a;
              return b-p.b;
          }
      }
  
      static boolean isPrime(int n) { 
          if (n <= 1) 
              return false; 
          if (n <= 3) 
              return true; 
          if (n % 2 == 0 ||  n % 3 == 0) 
              return false; 
          for (int i = 5; i * i <= n; i = i + 6) 
              if (n % i == 0 || n % (i + 2) == 0) 
                  return false; 
          return true; 
      } 
  
      static long gcd(long a, long b) {
          if (b == 0)
              return a;
          return gcd(b, a % b);
      }
  
      static long fast_pow(long base, long n, long M) {
          if (n == 0)
              return 1;
          if (n == 1)
              return base % M;
          long halfn = fast_pow(base, n / 2, M);
          if (n % 2 == 0)
              return (halfn * halfn) % M;
          else
              return (((halfn * halfn) % M) * base) % M;
      }
  
      static long modInverse(long n, long M) {
          return fast_pow(n, M - 2, M);
      }
  
      static class InputReader {
          public BufferedReader reader;
          public StringTokenizer tokenizer;
  
          public InputReader(InputStream stream) {
              reader = new BufferedReader(new InputStreamReader(stream), 9992768);
              tokenizer = null;
          }
  
          public String next() {
              while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                  try {
                      tokenizer = new StringTokenizer(reader.readLine());
                  } catch (IOException e) {
                      throw new RuntimeException(e);
                  }
              }
              return tokenizer.nextToken();
          }
  
          public int nextInt() {
              return Integer.parseInt(next());
          }
  
          public long nextLong() {
              return Long.parseLong(next());
          }
      }
  }