#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void prn(Arg1&& arg1) {
  cout << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void prn(Arg1&& arg1, Args&&... args) {
  cout << arg1 << " ";
  prn(args...);
}
template <typename Arg1>
void read(Arg1&& arg1) {
  cin >> arg1;
}
template <typename Arg1, typename... Args>
void read(Arg1&& arg1, Args&&... args) {
  cin >> arg1;
  read(args...);
}
string s, t;
const int N = 401, inf = 1e9;
int dp[N][N][N];
int n, m;
int maxpos(int i1, int i2, int i3) {
  if (i1 == n) {
    if (i3 == m)
      return i2;
    else
      return -inf;
  }
  int& ans = dp[i1][i2][i3];
  if (ans != -1) return ans;
  ans = maxpos(i1 + 1, i2, i3);
  if (i2 < m && s[i1] == t[i2]) ans = max(ans, maxpos(i1 + 1, i2 + 1, i3));
  if (i3 < m && s[i1] == t[i3]) ans = max(ans, maxpos(i1 + 1, i2, i3 + 1));
  return ans;
}
void solve() {
  read(s, t);
  n = s.size(), m = t.size();
  for (int i = 0; i < n + 1; ++i)
    for (int j = 0; j < m + 1; ++j)
      for (int k = 0; k < m + 1; ++k) dp[i][j][k] = -1;
  for (int take1 = 0; take1 <= m; ++take1) {
    if (maxpos(0, 0, take1) >= take1) {
      prn("YES");
      return;
    }
  }
  prn("NO");
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  read(t);
  while (t--) solve();
  return 0;
}
