#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while (!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
               __attribute__((unused)) int idx,
               __attribute__((unused)) int LINE_NUM) {
  cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if (idx > 0)
    cerr << ", ";
  else
    cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss;
  ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
double get_time() { return 1.0 * clock() / CLOCKS_PER_SEC; }
void solve() {
  string s, t;
  cin >> s >> t;
  int n = s.size(), m = t.size();
  vector<vector<int>> pos(26, vector<int>(n + 2, n));
  for (int i = 0; i < n; i++) {
    pos[s[i] - 'a'][i] = i;
  }
  for (int i = 0; i < 26; i++) {
    for (int j = n - 1; j >= 0; j--) pos[i][j] = min(pos[i][j], pos[i][j + 1]);
  }
  for (int i = 0; i <= m; i++) {
    string t1 = t.substr(0, i), t2 = t.substr(i);
    int m1 = t1.size(), m2 = t2.size();
    vector<vector<int>> dp(m1 + 2, vector<int>(m2 + 2, n + 1));
    dp[0][0] = 0;
    for (int j = 0; j <= m1; j++) {
      for (int k = 0; k <= m2; k++) {
        if (k < m2) {
          int idx = pos[t2[k] - 'a'][dp[j][k]];
          if (idx < n) dp[j][k + 1] = min(dp[j][k + 1], idx + 1);
        }
        if (j < m1) {
          int idx = pos[t1[j] - 'a'][dp[j][k]];
          if (idx < n) dp[j + 1][k] = min(dp[j + 1][k], idx + 1);
        }
      }
    }
    if (dp[m1][m2] < n + 1) {
      42;
      cout << "YES" << '\n';
      return;
    }
  }
  cout << "NO" << '\n';
}
int main() {
  fast();
  int t;
  cin >> t;
  while (t--) solve();
}
