#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
int main() {
  {
    ios::sync_with_stdio(0);
    cin.tie(0);
  };
  int t;
  cin >> t;
  while (t--) {
    string s, t;
    cin >> s >> t;
    int n = s.length(), m = t.length();
    bool ok = 0;
    for (int st = 0; st < (m + 1); st++) {
      vector<vector<int> > dp(n + 1, vector<int>(st + 1, -1));
      int b = m - st;
      dp[0][0] = 0;
      for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= st; j++) {
          if (dp[i - 1][j] == -1) continue;
          if (j < st && s[i - 1] == t[j])
            dp[i][j + 1] = max(dp[i][j + 1], dp[i - 1][j]);
          if (dp[i - 1][j] < b && s[i - 1] == t[dp[i - 1][j] + st]) {
            dp[i][j] = max(dp[i][j], dp[i - 1][j] + 1);
          }
          dp[i][j] = max(dp[i][j], dp[i - 1][j]);
        }
      }
      if (dp[n][st] == b) {
        ok = 1;
        break;
      }
    }
    cout << (ok ? "YES" : "NO") << '\n';
  }
}
