#include <bits/stdc++.h>
using namespace std;
int T;
string s, t;
vector<int> get(string tem) {
  vector<int> ans;
  int p = 0, x;
  while ((x = s.find(tem, p)) != -1) {
    ans.push_back(x);
    p = x + 1;
  }
  return ans;
}
void solve() {
  cin >> s >> t;
  int ls = s.length(), lt = t.length();
  bool f = false;
  for (int i = 1; i < lt; i++) {
    int x = i;
    string left = t.substr(0, x);
    vector<int> p1, p2;
    p1 = get(left);
    string right = t.substr(x);
    reverse(right.begin(), right.end());
    p2 = get(right);
    for (int j = 0; j < p1.size(); j++)
      for (int k = 0; k < p2.size(); k++)
        if (p1[j] + left.size() == p2[k] + right.size() + 1) {
          f = true;
          puts("YES");
          return;
        }
  }
  if (s.find(t) != -1) f = true;
  reverse(t.begin(), t.end());
  if (s.find(t) != -1) f = true;
  if (f)
    puts("YES");
  else
    puts("NO");
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}
