#include <bits/stdc++.h>
using namespace std;
const int INF = 1e6;
using VI = vector<int>;
using VVI = vector<VI>;
int n, m;
string s, p, p1, p2;
VVI seg, R;
int f(int i, int j) {
  int& res = R[i][j];
  if (res != -1) return res;
  if (i + j == 0) return res = 0;
  res = INF;
  if (i) {
    int x = f(i - 1, j);
    if (x < INF) res = min(res, seg[x][p1[i - 1] - 'a'] + 1);
  }
  if (j) {
    int x = f(i, j - 1);
    if (x < INF) res = min(res, seg[x][p2[j - 1] - 'a'] + 1);
  }
  return res;
}
bool ok() {
  for (int e = 0; e <= m; ++e) {
    int d = m - e;
    p1 = p.substr(0, e);
    p2 = p.substr(e);
    R = VVI(e + 1, VI(d + 1, -1));
    if (f(e, d) < INF) return true;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    cin >> s >> p;
    n = s.size();
    m = p.size();
    seg = VVI(n + 1, VI(26, INF));
    for (int i = n - 1; i >= 0; --i) {
      seg[i] = seg[i + 1];
      seg[i][s[i] - 'a'] = i;
    }
    cout << (ok() ? "YES" : "NO") << endl;
  }
}
