#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f, mod = 1000000007;
const double pi = 3.1415926535897932, eps = 1e-6;
void upd(int &x, int y) {
  if (x < y) x = y;
}
int T, n, m, f[405][405];
string s, t;
void solve() {
  cin >> s >> t;
  n = s.size();
  m = t.size();
  s = ' ' + s;
  t = ' ' + t;
  for (int(i) = (0); (i) <= (m); (i)++) {
    int u = m - i;
    for (int(j) = (0); (j) <= (n); (j)++)
      for (int(k) = (0); (k) <= (i); (k)++) f[j][k] = -1;
    f[0][0] = 0;
    for (int(j) = (0); (j) <= (n); (j)++)
      for (int(k) = (0); (k) <= (min(j, i)); (k)++) {
        if (f[j][k] == -1) continue;
        if (k < i && s[j + 1] == t[k + 1]) {
          upd(f[j + 1][k + 1], f[j][k]);
        }
        int cur = f[j][k];
        if (cur < u && t[i + cur + 1] == s[j + 1])
          upd(f[j + 1][k], cur + 1);
        else
          upd(f[j + 1][k], cur);
      }
    if (f[n][i] == u) {
      cout << "YES\n";
      return;
    }
  }
  cout << "NO\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin >> T;
  while (T--) solve();
  return 0;
}
