#include <bits/stdc++.h>
using namespace std;
string s, t;
int dp[401][401][401];
int rec(int i, int j, int k) {
  if (s.length() == i) {
    if (t.length() == k) return j;
    return -1e9;
  }
  if (dp[i][j][k] != -1) return dp[i][j][k];
  int ans = rec(i + 1, j, k);
  if (j < t.length() && s[i] == t[j]) ans = max(ans, rec(i + 1, j + 1, k));
  if (k < t.length() && s[i] == t[k]) ans = max(ans, rec(i + 1, j, k + 1));
  return dp[i][j][k] = ans;
}
void solve() {
  cin >> s >> t;
  int n = s.length() + 1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < t.length() + 1; j++)
      for (int k = 0; k < t.length() + 1; k++) dp[i][j][k] = -1;
  for (int i = 0; i < t.length() + 1; i++) {
    if (rec(0, 0, i) >= i) {
      cout << "YES\n";
      return;
    }
  }
  cout << "NO\n";
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) solve();
}
