#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
void solve() {
  string s, t;
  cin >> s >> t;
  int cnt = 0;
  for (int p = 1; p <= t.size(); p++) {
    string a = t.substr(0, p);
    string b = t.substr(p);
    vector<vector<int> > dp(s.size(), vector<int>(a.size() + 1, -INF));
    for (int i = 0; i < s.size(); i++) {
      for (int j = 0; j <= a.size(); j++) {
        int ans1 = i > 0 ? dp[i - 1][j] : (j > 0 ? -INF : 0);
        if (ans1 >= 0 && ans1 < b.size() && b[ans1] == s[i])
          dp[i][j] = max(dp[i][j], ans1 + 1);
        if (j > 0 && s[i] == a[j - 1])
          dp[i][j] =
              max(dp[i][j], i > 0 ? dp[i - 1][j - 1] : (j == 1 ? 0 : -INF));
        dp[i][j] = max(dp[i][j], ans1);
      }
    }
    if (dp[s.size() - 1][a.size()] == b.size()) {
      cout << "YES\n";
      return;
    }
  }
  cout << "NO\n";
  return;
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
}
