#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);
  for (int i = 0; i < n; i++) pos[s[i] - 'a'].push_back(i);
  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, 500));
    dp[0][0] = 0;
    for (int j = 0; j <= m1; j++) {
      for (int k = 0; k <= m2; k++) {
        if (k < m2) {
          int idx = lower_bound(pos[t2[k] - 'a'].begin(),
                                pos[t2[k] - 'a'].end(), dp[j][k]) -
                    pos[t2[k] - 'a'].begin();
          if (idx != (int)pos[t2[k] - 'a'].size())
            dp[j][k + 1] = min(dp[j][k + 1], pos[t2[k] - 'a'][idx] + 1);
        }
        if (j < m1) {
          int idx = lower_bound(pos[t1[j] - 'a'].begin(),
                                pos[t1[j] - 'a'].end(), dp[j][k]) -
                    pos[t1[j] - 'a'].begin();
          if (idx != (int)pos[t1[j] - 'a'].size())
            dp[j + 1][k] = min(dp[j + 1][k], pos[t1[j] - 'a'][idx] + 1);
        }
      }
    }
    if (dp[m1][m2] < 500) {
      cout << "YES" << '\n';
      return;
    }
  }
  cout << "NO" << '\n';
}
int main() {
  fast();
  int t;
  cin >> t;
  while (t--) solve();
}
