#include <bits/stdc++.h>
using namespace std;
const long long N = 410;
long long T, n, l1, l2, k, f[N][N], cnt;
bool flag;
string s, t, t1, t2;
signed main() {
  scanf("%lld", &T);
  while (T--) {
    cin >> s >> t, flag = cnt = 0, n = s.size();
    for (long long i = 0; i < n; i++) {
      if (s[i] == t[cnt]) ++cnt;
      if (cnt == t.size()) {
        puts("YES"), flag = 1;
        break;
      }
    }
    if (flag) continue;
    for (long long ys = 1; ys < t.size(); ys++) {
      t1 = t.substr(0, ys), t2 = t.substr(ys), l1 = t1.size(), l2 = t2.size();
      memset(f, -1, sizeof(f)), f[0][0] = 0;
      for (long long i = 0; i < n; i++)
        for (long long j = 0; j <= l1; j++)
          if ((k = f[i][j]) >= 0) {
            if (j < l1 && s[i] == t1[j])
              f[i + 1][j + 1] = max(k, f[i + 1][j + 1]);
            if (k < l2 && s[i] == t2[k]) f[i + 1][j] = max(k + 1, f[i + 1][j]);
            f[i + 1][j] = max(k, f[i + 1][j]);
          }
      if (f[n][l1] == l2) {
        puts("YES"), flag = 1;
        break;
      }
    }
    if (!flag) puts("NO");
  }
  return 0;
}
