#include <bits/stdc++.h>
using namespace std;
const int NN = 404;
const int INF = 1000;
int dp[2][2][NN][NN];
bool vis[2][2][NN][NN];
string s, t;
int get() {
  for (int z = 0; z < 2; z++)
    for (int i = 0; i < 2; i++)
      for (int j = 0; j <= t.size(); j++)
        for (int k = 0; k <= s.size(); k++) dp[z][i][j][k] = -1;
  for (int z = 0; z < 2; z++)
    for (int i = 0; i <= t.size(); i++) dp[s.size() % 2][z][i][t.size()] = 0;
  for (int k = (int)s.size() - 1; k >= 0; k--) {
    int d = k % 2;
    for (int i = t.size(); i >= 0; i--) {
      for (int j = t.size(); j >= 0; j--) {
        int& res0 = dp[d][0][i][j];
        int& res1 = dp[d][1][i][j];
        res0 = res1 = -INF;
        res0 = ((res0) > (dp[1 - d][0][i][j]) ? (res0) : (dp[1 - d][0][i][j]));
        res1 = ((res1) > (dp[1 - d][1][i][j]) ? (res1) : (dp[1 - d][1][i][j]));
        if (j < t.size())
          res0 =
              ((res0) > (dp[d][0][i][j + 1]) ? (res0) : (dp[d][0][i][j + 1]));
        if (i < t.size() && t[i] == s[k]) {
          res0 = ((res0) > (dp[1 - d][0][i + 1][j] + 1)
                      ? (res0)
                      : (dp[1 - d][0][i + 1][j] + 1));
          res1 = ((res1) > (dp[1 - d][1][i + 1][j] + 1)
                      ? (res1)
                      : (dp[1 - d][1][i + 1][j] + 1));
        }
        if (j < t.size() && t[j] == s[k]) {
          res1 = ((res1) > (dp[1 - d][1][i][j + 1] + 1)
                      ? (res1)
                      : (dp[1 - d][1][i][j + 1] + 1));
        }
        res0 = ((res0) > (res1) ? (res0) : (res1));
      }
    }
  }
  return dp[0][0][0][0];
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(0), cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    cin >> s >> t;
    if (get() >= t.size())
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
