#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
string s, t;
long long nxt[401][26];
bool solve(string a, string b) {
  long long n = a.size(), m = b.size();
  long long dp[n + 1][m + 1];
  for (long long i = 0; i <= n; i++) {
    for (long long j = 0; j <= m; j++) dp[i][j] = 1000000000000000000;
  }
  dp[0][0] = 0;
  for (long long i = 0; i <= n; i++) {
    for (long long j = 0; j <= m; j++) {
      if (dp[i][j] > s.size()) continue;
      long long len = dp[i][j];
      if (i < n && nxt[len][a[i] - 'a'] < 1000000000000000000) {
        dp[i + 1][j] = min(dp[i + 1][j], nxt[len][a[i] - 'a'] + 1);
      }
      if (j < m && nxt[len][b[j] - 'a'] < 1000000000000000000) {
        dp[i][j + 1] = min(dp[i][j + 1], nxt[len][b[j] - 'a'] + 1);
      }
    }
  }
  if (dp[n][m] < 1000000000000000000)
    return true;
  else
    return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long T;
  cin >> T;
  while (T--) {
    cin >> s >> t;
    for (long long i = 0; i <= s.size(); i++) {
      for (long long j = 0; j < 26; j++) nxt[i][j] = 1000000000000000000;
    }
    for (long long i = s.size() - 1; i >= 0; i--) {
      for (long long j = 0; j < 26; j++) nxt[i][j] = nxt[i + 1][j];
      nxt[i][s[i] - 'a'] = i;
    }
    bool flag = true;
    for (long long i = 0; i < t.size(); i++) {
      string a, b;
      for (long long j = 0; j < t.size(); j++) {
        if (j < i)
          a += t[j];
        else
          b += t[j];
      }
      if (solve(a, b)) {
        cout << "YES";
        flag = false;
        break;
      }
    }
    if (flag) cout << "NO";
    cout << "\n";
  }
  return 0;
}
