#include <bits/stdc++.h>
using namespace std;
int INF = int(1e9);
string s, t;
bool can(string &a, string &b, vector<vector<int>> &nxt) {
  vector<vector<int>> dp(int(a.size()) + 1,
                         vector<int>(int(b.size()) + 1, INF));
  dp[0][0] = 0;
  for (int i = 0, thx = int(a.size()) + 1; i < thx; i++)
    for (int j = 0, thx = int(b.size()) + 1; j < thx; j++) {
      if (dp[i][j] > int(s.size())) continue;
      int len = dp[i][j];
      if (i + 1 <= int(a.size()) && nxt[len][a[i]] < INF) {
        dp[i + 1][j] = min(dp[i + 1][j], nxt[len][a[i]] + 1);
      }
      if (j + 1 <= int(b.size()) && nxt[len][b[j]] < INF) {
        dp[i][j + 1] = min(dp[i][j + 1], nxt[len][b[j]] + 1);
      }
    }
  return dp[int(a.size())][int(b.size())] < INF;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T;
  cin >> T;
  while (T--) {
    cin >> s >> t;
    for (auto &c : s) {
      c -= 'a';
    }
    for (auto &c : t) {
      c -= 'a';
    }
    vector<vector<int>> nxt(int(s.size()) + 1, vector<int>(26, INF));
    for (int i = int(s.size()) - 1; i >= 0; i--) {
      nxt[i] = nxt[i + 1];
      nxt[i][s[i]] = i;
    }
    bool cann = false;
    for (int i = 0, thx = int(t.size()); i < thx; i++) {
      string a = t.substr(0, i), b = t.substr(i, int(t.size()));
      if (can(a, b, nxt)) {
        cann = true;
        break;
      }
    }
    if (cann)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
