#include <bits/stdc++.h>
using namespace std;
bool ch(string& s, string& a, string& b, vector<vector<long long> >& prec) {
  long long dp[(long long)a.length() + 5][(long long)b.length() + 5];
  for (long long i = 0; i <= a.length(); i++) {
    for (long long j = 0; j <= b.length(); j++) {
      dp[i][j] = INT_MAX;
      if (!i and !j)
        dp[i][j] = -1;
      else {
        if (i and dp[i - 1][j] + 1 < s.length())
          dp[i][j] = min(dp[i][j], prec[dp[i - 1][j] + 1][a[i - 1] - 'a']);
        if (j and dp[i][j - 1] + 1 < s.length())
          dp[i][j] = min(dp[i][j], prec[dp[i][j - 1] + 1][b[j - 1] - 'a']);
      }
    }
  }
  if (dp[a.length()][b.length()] < s.length())
    return 1;
  else
    return 0;
}
void pre(string& s, vector<vector<long long> >& prec) {
  prec.assign(s.length() + 1, vector<long long>(30, INT_MAX));
  for (long long i = s.length() - 1; i >= 0; i--) {
    prec[i][s[i] - 'a'] = i;
    for (long long j = 0; j < 26; j++) {
      if (i + 1 < s.length()) prec[i][j] = min(prec[i][j], prec[i + 1][j]);
    }
  }
}
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    string s, p;
    vector<vector<long long> > prec;
    cin >> s >> p;
    pre(s, prec);
    bool poss = 0;
    for (long long i = 0; i < p.length(); i++) {
      string a = p.substr(0, i + 1);
      string b = p.substr(i + 1, p.length() - i - 1);
      poss |= ch(s, a, b, prec);
    }
    if (poss)
      cout << "YES";
    else
      cout << "NO";
    cout << endl;
  }
}
