#include <bits/stdc++.h>
using namespace std;
int dp[500][500];
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 is = 0;
    for (int div = 1; div <= m; div++) {
      for (int i = 0; i < 500; i++)
        for (int j = 0; j < 500; j++) dp[i][j] = -1;
      for (int i = 0; i < 500; i++) dp[i][0] = 0;
      if (s[0] == t[div]) dp[0][0] = 1;
      if (s[0] == t[0]) dp[0][1] = 0;
      if (m == 1)
        if (s[0] == t[0]) is = 1;
      for (int i = 1; i < n; i++) {
        for (int reach = 0; reach <= div; reach++) {
          dp[i][reach] = dp[i - 1][reach];
          if (reach > 0)
            if (s[i] == t[reach - 1])
              if (dp[i - 1][reach - 1] != -1)
                dp[i][reach] = max(dp[i][reach], dp[i - 1][reach - 1]);
          if (dp[i - 1][reach] != -1)
            if (s[i] == t[dp[i - 1][reach] + div])
              dp[i][reach] = max(dp[i][reach], dp[i - 1][reach] + 1);
          if (reach == div && dp[i][reach] == m - div) is = 1;
        }
      }
    }
    cout << (is ? "YES\n" : "NO\n");
  }
  return 0;
}
