#include <bits/stdc++.h>
using namespace std;
int dp[405][405];
bool judge(string s, string t1, string t2) {
  memset(dp, -1, sizeof(dp));
  int slen = s.length(), t1len = t1.length(), t2len = t2.length();
  dp[0][0] = 0;
  for (int i = 0; i < slen; ++i) {
    for (int j = 0; j <= t1len; ++j) {
      if (dp[i][j] >= 0) {
        if (j < t1len && s[i] == t1[j])
          dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j]);
        if (dp[i][j] < t2len && t2[dp[i][j]] == s[i])
          dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + 1);
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
      }
    }
  }
  return dp[slen][t1len] >= t2len;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    string s, t;
    cin >> s >> t;
    int slen = s.length(), tlen = t.length();
    bool ok = 0;
    for (int i = 1; i <= tlen; ++i) {
      if (judge(s, t.substr(0, i), t.substr(i, tlen - i))) {
        ok = 1;
        break;
      }
    }
    if (ok)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
