#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 1e5 + 6;
const long long mx = 1e9;
int dp[410][410];
string s, t;
void solve() {
  int n, m;
  cin >> s >> t;
  n = s.length();
  m = t.length();
  for (int k = 0; k <= m - 1; k++) {
    int y = m - k;
    memset(dp, -1, sizeof(dp));
    dp[0][0] = 0;
    for (int i = 0; i <= n - 1; i++)
      for (int j = 0; j <= k; j++) {
        if (dp[i][j] == -1) continue;
        if (j < k && s[i] == t[j])
          dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j]);
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + (t[dp[i][j] + k] == s[i]));
      }
    if (dp[n][k] == y) {
      puts("YES");
      return;
    }
  }
  puts("NO");
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int _;
  cin >> _;
  while (_--) solve();
  return 0;
}
