#include <bits/stdc++.h>
using namespace std;
string s, t;
int dp[404][404][404];
int n, m;
int go(int i1, int i2, int i3) {
  if (i1 == n) {
    if (i3 == m) return i2;
    return 0;
  }
  int &e = dp[i1][i2][i3];
  if (e == -1) {
    e = go(i1 + 1, i2, i3);
    if (i3 < m && s[i1] == t[i3]) e = max(e, go(i1 + 1, i2, i3 + 1));
    if (i2 < m && s[i1] == t[i2]) e = max(e, go(i1 + 1, i2 + 1, i3));
  }
  return e;
}
void solve() {
  cin >> s >> t;
  n = s.size();
  m = t.size();
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++)
      for (int k = 0; k <= n; k++) dp[i][j][k] = -1;
  for (int i = 1; i <= m; i++) {
    if (go(0, 0, i) >= i) {
      cout << "YES\n";
      return;
    }
  }
  cout << "NO\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
}
