#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic ignored "-Wmissing-declarations"
bool check(const string& s, const string& t1, const string& t2) {
  vector<int> dp(t1.size() + 1, -1);
  dp[0] = 0;
  for (char c : s) {
    auto ndp = dp;
    for (int i = 0; i <= t1.size(); ++i)
      if (dp[i] >= 0 && dp[i] < t2.size() && t2[dp[i]] == c)
        ndp[i] = max(ndp[i], dp[i] + 1);
    for (int i = 0; i < t1.size(); ++i)
      if (dp[i] >= 0 && t1[i] == c) ndp[i + 1] = max(ndp[i + 1], dp[i]);
    dp.swap(ndp);
  }
  return dp.back() == t2.size();
}
void solve() {
  string s, p;
  cin >> s >> p;
  for (size_t i = 0; i < p.size(); ++i)
    if (check(s, p.substr(0, i), p.substr(i, p.size() - i))) {
      cout << "YES\n";
      return;
    }
  cout << "NO\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
}
