#include <bits/stdc++.h>
using namespace std;
const int N = 405;
const int inf = 1e9;
int dp[N][N], n, m, nxt[N][27];
string s, t;
bool check(const string &u, const string &v) {
  string a = u;
  string b = v;
  int sza = a.size();
  int szb = b.size();
  a = " " + a;
  b = " " + b;
  for (int i = 0; i <= sza; i++) {
    for (int j = 0; j <= szb; j++) dp[i][j] = inf;
  }
  dp[0][0] = 0;
  for (int i = 0; i <= sza; i++) {
    for (int j = 0; j <= szb; j++) {
      if (i == 0 && j == 0) continue;
      if (j && dp[i][j - 1] != 1e9)
        dp[i][j] = min(dp[i][j], nxt[dp[i][j - 1]][b[j] - 'a']);
      if (i && dp[i - 1][j] != 1e9)
        dp[i][j] = min(dp[i][j], nxt[dp[i - 1][j]][a[i] - 'a']);
    }
  }
  return (dp[sza][szb] != inf);
}
void sol() {
  cin >> s >> t;
  n = s.size();
  m = t.size();
  s = " " + s;
  t = " " + t;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= 'z' - 'a'; j++) {
      nxt[i][j] = inf;
      for (int k = i + 1; k <= n; k++) {
        if (s[k] - 'a' == j) {
          nxt[i][j] = k;
          break;
        }
      }
    }
  }
  for (int i = 1; i <= m; i++) {
    if (check(t.substr(1, i), t.substr(i + 1, m - i))) {
      cout << "YES" << '\n';
      return;
    }
  }
  cout << "NO" << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) sol();
}
