#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using cp = complex<double>;
namespace IO {
template <typename T, typename... T2>
inline bool read(T &num, T2 &...rest);
inline bool read() { return true; }
template <typename... T>
inline bool read(char *a, T &...rest) {
  int ch = getchar();
  for (; ch < 33 || ch > 126; ch = getchar())
    if (ch == EOF) return false;
  for (; ch >= 33 && ch <= 126; ch = getchar()) {
    *(a++) = ch;
  }
  *a = 0;
  return read(rest...);
}
template <typename T, typename... T2>
inline bool read(T &num, T2 &...rest) {
  num = 0;
  bool fl = 0;
  int ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-')
      fl = 1;
    else if (ch == EOF) {
      return false;
    }
  for (; isdigit(ch); ch = getchar()) num = (num << 3) + (num << 1) + (ch ^ 48);
  if (fl) num = -num;
  return read(rest...);
}
void put() { puts(""); }
template <class... T2>
void put(const ll num, const T2... rest);
template <class... T2>
void put(const char *num, const T2... rest);
template <class... T2>
void put(const char num, const T2... rest);
template <class... T2>
void put(const double num, const T2... rest);
template <class... T2>
void put(const int num, const T2... rest) {
  printf("%d ", num);
  put(rest...);
}
template <class... T2>
void put(const ll num, const T2... rest) {
  printf("%lld ", num);
  put(rest...);
}
template <class... T2>
void put(const char *num, const T2... rest) {
  printf("%s ", num);
  put(rest...);
}
template <class... T2>
void put(const char num, const T2... rest) {
  printf("%c ", num);
  put(rest...);
}
template <class... T2>
void put(const double num, const T2... rest) {
  printf("%.13f ", num);
  put(rest...);
}
void yes() { puts("YES"); }
void no() { puts("NO"); }
void ff() { fflush(stdout); }
}  // namespace IO
using namespace IO;
using db = double;
using vi = vector<int>;
using pi = pair<int, int>;
const int mod = 998244353, inv2 = (mod + 1) / 2;
const int maxn = 400 + 10;
const int inf = 1e9 + 3;
void prepare() {}
char s[maxn], t[maxn];
int sn, tn;
ll f[maxn][maxn][2];
void Solve(int cas = 1) {
  ll n, m;
  read(s + 1);
  read(t + 1);
  ll sn = n = strlen(s + 1);
  ll tn = strlen(t + 1);
  t[tn + 2] = 0;
  for (int p = 1; p <= tn; p++) {
    char *tt = t + p;
    ll t2 = tn - p;
    for (int i = 0; i <= sn; i++) {
      for (int j = 0; j <= tn; j++) {
        f[i][j][0] = f[i][j][1] = -1;
      }
    }
    f[1][0][1] = -1;
    f[1][0][0] = (s[1] == tt[1] ? 1 : 0);
    f[1][1][1] = (s[1] == t[1] ? 0 : -1);
    f[1][1][0] = -1;
    for (int i = 2; i <= sn; i++) {
      for (int j = 0; j <= p; j++) {
        if (j) {
          if (s[i] == t[j])
            f[i][j][1] = max(f[i - 1][j - 1][0], f[i - 1][j - 1][1]);
        }
        int k0 = max(f[i - 1][j][0], f[i - 1][j][1]);
        if (k0 != -1) k0 += (s[i] == tt[k0 + 1]);
        f[i][j][0] = k0;
      }
    }
    if (f[sn][p][0] == t2 || f[sn][p][1] == t2) {
      yes();
      return;
    }
  }
  no();
}
void Solvem() {
  int T;
  read(T);
  for (int i = 1; i <= T; i++) Solve(i);
}
int main() {
  prepare();
  Solvem();
  return 0;
}
