#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    string s, t;
    cin >> s >> t;
    if (s == t) {
      cout << "YES\n";
      continue;
    }
    int n = s.length();
    int m = t.length();
    int j = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == t[j]) {
        ++j;
        if (j == m) break;
      }
    }
    if (j == m) {
      cout << "YES\n";
      continue;
    }
    int flag = 1;
    for (int len = 1; len < m; len++) {
      string a = t.substr(0, len);
      string b = t.substr(len);
      int dp[2][len + 1];
      for (int j = 1; j <= len; j++) dp[0][j] = -1;
      dp[0][0] = 0;
      int r = 0;
      for (int i = 0; i < n; i++) {
        for (int j = 0; j <= len; j++) {
          dp[r ^ 1][j] = dp[r][j];
          if (dp[r][j] >= 0 && dp[r][j] < b.length() && b[dp[r][j]] == s[i])
            ++dp[r ^ 1][j];
          if (dp[r][j - 1] >= 0 && j > 0 && a[j - 1] == s[i])
            dp[r ^ 1][j] = max(dp[r ^ 1][j], dp[r][j - 1]);
        }
        r ^= 1;
      }
      if (dp[r][len] == b.length()) {
        cout << "YES\n";
        flag = 0;
        break;
      }
    }
    if (flag) cout << "NO\n";
  }
}
