#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll LINF = 1001002003004005006ll;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
vector<vector<int>> fillnxt(string s) {
  int n = (int)s.size();
  vector<vector<int>> ret(n + 1, vector<int>(26, 1000000000));
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < (26); j++) ret[i][j] = ret[i + 1][j];
    ret[i][s[i] - 'a'] = i;
  }
  return ret;
}
void solve() {
  string s, t;
  cin >> s >> t;
  int n = (int)s.size(), m = (int)t.size();
  auto nxt = fillnxt(s);
  for (int cut = 1; cut <= m; cut++) {
    string p1 = t.substr(0, cut), p2 = t.substr(cut, m - cut);
    vector<vector<int>> dp(p1.size() + 1,
                           vector<int>(p2.size() + 1, 1000000000));
    dp[0][0] = 0;
    for (int i = 0; i < (p1.size() + 1); i++) {
      for (int j = 0; j < (p2.size() + 1); j++) {
        if (dp[i][j] >= 1000000000) continue;
        if (i < p1.size()) chmin(dp[i + 1][j], nxt[dp[i][j]][p1[i] - 'a'] + 1);
        if (j < p2.size()) chmin(dp[i][j + 1], nxt[dp[i][j]][p2[j] - 'a'] + 1);
      }
    }
    if (dp[p1.size()][p2.size()] < 1000000000) {
      cout << "YES" << endl;
      return;
    }
  }
  cout << "NO" << endl;
  return;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  int q;
  cin >> q;
  while (q--) solve();
  return 0;
}
