#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long infll = 0x3f3f3f3f3f3f3f3f;
const long long mod = 1e9 + 7;
const int maxn = 5e3 + 10;
bool check(string &s, string &t1, string &t2) {
  int s_len = s.size() - 1;
  int t1_len = t1.size() - 1;
  int t2_len = t2.size() - 1;
  vector<vector<int>> dp(s_len + 5, vector<int>(s_len + 5, -1));
  dp[0][0] = 0;
  for (int i = 1; i <= s_len; ++i)
    for (int j = 0; j <= i and j <= t1_len; ++j) {
      if (j - 1 >= 0 and dp[i - 1][j - 1] >= 0 and s[i] == t1[j])
        dp[i][j] = max(dp[i][j], dp[i - 1][j - 1]);
      if (dp[i - 1][j] >= 0 and dp[i - 1][j] + 1 <= t2_len and
          s[i] == t2[dp[i - 1][j] + 1])
        dp[i][j] = max(dp[i][j], dp[i - 1][j] + 1);
      dp[i][j] = max(dp[i][j], dp[i - 1][j]);
    }
  if (dp[s_len][t1_len] == t2_len) return true;
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    string s, t;
    cin >> s >> t;
    bool flag = true;
    for (int i = 0; i < t.size() and flag; ++i) {
      string t1 = "", t2 = "";
      for (int j = 0; j <= i; ++j) t1 += t[j];
      for (int j = i + 1; j < t.size(); ++j) t2 += t[j];
      if (check(string(" ") += s, string(" ") += t1, string(" ") += t2)) {
        cout << "YES" << endl;
        flag = false;
      }
    }
    if (flag) cout << "NO" << endl;
  }
  return 0;
}
