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.*;
  import java.util.*;
  
  public class Stack3 {
  
      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')
                      break;
                  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();
          }
      }
  
      static Reader sc = new Reader();
      static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
      static int team1=0;
      static int team2=0;
      static int minkicks=10;
  
      public static void main(String[] args) throws IOException {
          //subsequence("abcdefghij");
  
          /*
           * For integer input: int n=inputInt();
           * For long input: long n=inputLong();
           * For double input: double n=inputDouble();
           * For String input: String s=inputString();
           * Logic goes here
           * For printing without space: print(a+""); where a is a variable of any datatype
           * For printing with space: printSp(a+""); where a is a variable of any datatype
           * For printing with new line: println(a+""); where a is a variable of any datatype
           */
  
       Scanner sc=new Scanner(System.in);
       int q=sc.nextInt();
       process:for(int p=0;p<q;p++){
           String s=sc.next();
           String t=sc.next();
           StringBuilder stringBuilder=new StringBuilder(s);
           stringBuilder.reverse();
           String rev=stringBuilder.toString().substring(1);
           String fst=s+rev;
           if(s.length()==1){
               if(s.equals(t)){
                   System.out.println("YES");
               }else{
                   System.out.println("NO");
               }
           }else if(t.length()==1){
               if(s.contains(t)){
                   System.out.println("YES");
               }else{
                   System.out.println("NO");
               }
           }else{
               for(int i=0;i<=t.length();i++){
                   String y1=t.substring(0,i);
                   String y2=t.substring(i);
                   for(int j=0;j<=s.length()-y1.length();j++){
                       int en=j+y1.length();
                       String yc=s.substring(j,en);
                      // System.out.println(yc);
                       if(yc.equals(y1)){
                           int ind =en-1;
                           int diff = s.length() - 1 - ind;
                           int y21 = s.length() - 1 + diff + 1;
                          /* if(yc.equals("cde")){
                               //System.out.println(y21);
                               //System.out.println(fst.substring(y21, y21 + y2.length()));
                           }*/
  
                           if (y21 + y2.length() <= fst.length() && fst.substring(y21, y21 + y2.length()).equals(y2)) {
                               System.out.println("YES");
                               continue process;
                           }
                          /* int diff=s.length()-1+2*(s.length()-1-en);
                           if(diff+y2.length()-1<=fst.length()){
                               String r1=fst.substring(diff,diff+y2.length()-1);
                               if(r1.equals(y2)){
                                   System.out.println("YES");
                                   continue process;
                               }
                           }*/
  
  
                       }
  
                   }
  
               }
               System.out.println("NO");
           }
       }
  
  
  
  
  
          bw.flush();
          bw.close();
  
  
      }
      public static class Score{
          int score;
      }
  
  
  
      public static int checker(int a) {
  
  
          if (a % 2 == 0) {
              return 1;
          } else {
              while (true) {
                  int b = 2;
                  if ((a + b) == (a ^ b)) {
                      return b;
                  }
              }
          }
      }
  
      public static boolean checkPrime(int n) {
          if (n == 0 || n == 1) {
              return false;
          }
          for (int j = 2; j * j <= n; j++) {
              if (n % j == 0) {
                  return false;
              }
          }
          return true;
      }
  
  
      public static void dfs1(List<List<Integer>> g, boolean[] visited, Stack<Integer> stack, int num) {
          visited[num] = true;
          for (Integer integer : g.get(num)) {
              if (!visited[integer]) {
                  dfs1(g, visited, stack, integer);
              }
          }
          stack.push(num);
      }
  
      public static void dfs2(List<List<Integer>> g, boolean[] visited, List<Integer> list, int num, int c,
                              int[] raj) {
          visited[num] = true;
  
          for (Integer integer : g.get(num)) {
              if (!visited[integer]) {
                  dfs2(g, visited, list, integer, c, raj);
              }
          }
          raj[num] = c;
          list.add(num);
  
      }
  
      public static int inputInt() throws IOException {
          return sc.nextInt();
      }
  
      public static long inputLong() throws IOException {
          return sc.nextLong();
      }
  
      public static double inputDouble() throws IOException {
          return sc.nextDouble();
      }
  
      public static String inputString() throws IOException {
          return sc.readLine();
      }
  
      public static void print(String a) throws IOException {
          bw.write(a);
      }
  
      public static void printSp(String a) throws IOException {
          bw.write(a + " ");
      }
  
      public static void println(String a) throws IOException {
          bw.write(a + "\n");
      }
  
  
      public static long getAns(int[] ar, int c, long[][] dp, int i, int sign) {
          if (i < 0) {
              return 1;
          }
  
          if (c <= 0) {
              return 1;
          }
  
          dp[i][c] = Math.max(dp[i][c], Math.max(ar[i] * getAns(ar, c - 1, dp, i - 1, sign), getAns(ar, c, dp, i - 1, 1)));
          return dp[i][c];
      }
  
  
      public static long power(long a, long b, long c) {
          long ans = 1;
          while (b != 0) {
              if (b % 2 == 1) {
                  ans = ans * a;
                  ans %= c;
              }
              a = a * a;
              a %= c;
              b /= 2;
          }
          return ans;
      }
  
      public static long power1(long a, long b, long c) {
          long ans = 1;
          while (b != 0) {
              if (b % 2 == 1) {
                  ans = multiply(ans, a, c);
              }
              a = multiply(a, a, c);
              b /= 2;
  
          }
          return ans;
  
      }
  
      public static long multiply(long a, long b, long c) {
          long res = 0;
          a %= c;
          while (b > 0) {
              if (b % 2 == 1) {
                  res = (res + a) % c;
              }
              a = (a + a) % c;
              b /= 2;
          }
  
          return res % c;
  
      }
  
      public static long totient(long n) {
          long result = n;
          for (long i = 2; i * i <= n; i++) {
              if (n % i == 0) {
                  //sum=sum+2*i;
                  while (n % i == 0) {
                      n /= i;
                      // sum=sum+n;
                  }
                  result -= result / i;
  
              }
          }
          if (n > 1) {
              result -= result / n;
  
          }
          return result;
      }
  
  
      public static long gcd(long a, long b) {
          if (b == 0) {
              return a;
          } else {
              return gcd(b, a % b);
          }
      }
  
      public int sumOfFlooredPairs(int[] nums) {
          // long sum=0;
          long mod = (long) (1e9 + 7);
          Arrays.sort(nums);
          long[] numerator = new long[nums.length];
          long[] denominator = new long[nums.length];
  
          long[] numerator1 = new long[nums.length];
          long[] denominator1 = new long[nums.length];
  
          long num = 1;
          long den = nums[0];
          numerator[0] = 1;
          denominator[0] = den;
          long num1 = 1;
          long den1 = nums[nums.length - 1];
          numerator1[nums.length - 1] = 1;
          denominator1[nums.length - 1] = den1;
  
  
          for (int i = 1; i < nums.length; i++) {
  
              long gcd1 = gcd(denominator[i - 1], nums[i]);
              long lcm = (denominator[i - 1] * nums[i]) / gcd1;
              long n1 = lcm / denominator[i - 1] * numerator[i - 1] + lcm / nums[i];
              numerator[i] = n1;
              denominator[i] = lcm;
  
              long gcd2 = gcd(denominator1[nums.length - i], nums[nums.length - 1 - i]);
              long lcm1 = (denominator1[nums.length - i] * nums[nums.length - 1 - i]) / gcd2;
              long n2 = lcm1 / denominator1[nums.length - i] * numerator1[nums.length - i] + lcm1 / nums[nums.length - 1 - i];
              numerator1[nums.length - 1 - i] = n2;
              denominator1[nums.length - 1 - i] = lcm1;
  
  
  
  
             /* prefix[i]=sum;
              sum12+=1d/nums[nums.length-1-i];
              prefix2[nums.length-1-i]=sum12;*/
  
          }
          /*System.out.println(Arrays.toString(numerator));
           System.out.println(Arrays.toString(denominator));*/
          int sum2 = 0;
          for (int i = 0; i < nums.length; i++) {
              //float d1=(float)(numerator[i]/(double)denominator[i]);
              sum2 += (int) (Math.floor((numerator[i] * nums[i]) / (double) denominator[i]));
              sum2 %= mod;
              if (i + 1 < nums.length) {
                  // float d2=(float)(numerator1[i+1]/(double)denominator1[i+1]);
                  sum2 += (int) (Math.floor((numerator1[i + 1] * nums[i]) / (double) denominator1[i + 1]));
                  sum2 %= mod;
              }
          }
          return sum2;
  
  
      }
  
      public static boolean[] primes(int n) {
          boolean[] p = new boolean[n + 1];
          p[0] = false;
          p[1] = false;
          for (int i = 2; i <= n; i++) {
              p[i] = true;
          }
  
          for (int i = 2; i * i <= n; i++) {
              if (p[i]) {
                  for (int j = i * i; j <= n; j += i) {
                      p[j] = false;
                  }
              }
  
          }
          return p;
      }
  
      public String LargestEven(String S) {
          //  char[] ar=S.toCharArray();
          int[] count = new int[10];
          for (int i = 0; i < S.length(); i++) {
              count[S.charAt(i) - '0']++;
          }
          int num = -1;
          for (int i = 0; i <= 8; i += 2) {
              if (count[i] > 0) {
                  num = i;
                  break;
              }
          }
          StringBuilder ans = new StringBuilder();
          for (int i = 9; i >= 0; i--) {
              if (i != num) {
                  for (int j = 1; j <= count[i]; j++) {
                      ans.append(i);
                  }
              } else {
                  for (int j = 1; j <= count[num] - 1; j++) {
                      ans.append(num);
                  }
  
              }
          }
          if (num != -1 && count[num] > 0) {
              ans.append(num);
          }
          return ans.toString();
      }
  
  }