#include <bits/stdc++.h>
#pragma comment(linker, "/stack:512000000")
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(NULL));
ll const mod = 1e9 + 7;
namespace {
ll mul(ll a, ll b) {
  ll val = a * b - (ll)((ld)a * b / mod) * mod;
  if (val < 0) val += mod;
  if (val >= mod) val -= mod;
  return val;
}
ll poww(ll a, ll b) {
  ll val = 1;
  a %= mod;
  while (b > 0) {
    if (b % 2) val = mul(a, val);
    a = mul(a, a);
    b >>= 1;
  }
  return val % mod;
}
ll inv(ll a) { return poww(a, mod - 2); }
}  // namespace
ll const maxn = 3e5 + 6;
ll dp[505][505];
bool solve(string s, string t1, string t2) {
  for (ll i = 0; i < 505; i++) {
    for (ll j = 1; j < 505; j++) {
      dp[i][j] = -1;
    }
  }
  for (ll i = 0; i < 505; i++) {
    dp[i][0] = 0;
  }
  for (ll i = 0; i <= s.size(); i++) {
    for (ll j = 0; j <= t1.size(); j++) {
      if (i) dp[i][j] = max(dp[i][j], dp[i - 1][j]);
      if (dp[i][j] == -1) continue;
      if (i == s.size()) continue;
      if (dp[i][j] < t2.size()) {
        if (s[i] == t2[dp[i][j]]) {
          dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + 1);
        }
      }
      if (j < t1.size()) {
        if (s[i] == t1[j]) {
          dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j]);
        }
      }
    }
  }
  return (dp[s.size()][t1.size()] == t2.size());
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll q;
  cin >> q;
  while (q--) {
    string s, t;
    cin >> s >> t;
    bool f = false;
    for (ll sz = 0; sz < t.size(); sz++) {
      f |= solve(s, t.substr(0, sz), t.substr(sz, s.size()));
    }
    cout << (f ? "YES\n" : "NO\n");
  }
  return 0;
}
