#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const vector<int> mods = {998244353, 1000000007, 1000000009};
const long long inf = 3e18;
const double pi = acos(-1.0);
const double eps = 0.0000001;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <class... K>
using umap = unordered_map<K...>;
template <class... K>
using uset = unordered_set<K...>;
long long T;
string s, t;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout.precision(12);
  cin >> T;
  for (long long _T = (0); _T < (T); ++_T) {
    cin >> s >> t;
    long long sn = s.length(), tn = t.length();
    for (long long st = (0); st < (tn + 1); ++st) {
      vector<long long> dp(st + 1, -1);
      dp[0] = 0;
      for (long long i = (0); i < (sn); ++i) {
        if (st == 1) {
        }
        vector<long long> nxdp = dp;
        for (long long j = (0); j < (st + 1); ++j) {
          nxdp[j] = max(nxdp[j], dp[j]);
          if (j < st && s[i] == t[j]) {
            nxdp[j + 1] = max(nxdp[j + 1], dp[j]);
          }
          if (dp[j] >= 0 && s[i] == t[dp[j] + st]) {
            nxdp[j] = max(nxdp[j], dp[j] + 1);
          }
        }
        dp = nxdp;
      }
      if (dp[st] == tn - st) {
        cout << "YES\n";
        goto outer;
      }
    }
    cout << "NO\n";
  outer:;
  }
  return 0;
}
