#include <bits/stdc++.h>
using namespace std;
int dp[404][404];
const int oo = 1e9 + 10;
inline void upd(int &first, int second) { first = max(first, second); }
void solve() {
  string s, t;
  cin >> s >> t;
  int n = (int)(s).size(), m = (int)(t).size();
  for (int k = 0; k <= m; k++) {
    for (int i = 0; i <= n; i++) {
      for (int j = 0; j <= k; j++) dp[i][j] = -oo;
    }
    dp[0][0] = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j <= k; j++) {
        upd(dp[i + 1][j], dp[i][j]);
        if (j < k && s[i] == t[j]) upd(dp[i + 1][j + 1], dp[i][j]);
        if (dp[i][j] != -oo && dp[i][j] < m - k && s[i] == t[k + dp[i][j]])
          upd(dp[i + 1][j], dp[i][j] + 1);
      }
    }
    if (dp[n][k] == m - k) {
      cout << "YES\n";
      return;
    }
  }
  cout << "NO\n";
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
