#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 4e2 + 10;
const int inf = 0x3f3f3f3f;
string s, str, a, b;
int nex[maxn][27], dp[maxn][maxn];
bool check() {
  memset(dp, inf, sizeof(dp));
  dp[0][0] = -1;
  for (int i = (0); i <= (a.size()); i++) {
    for (int j = (0); j <= (b.size()); j++) {
      if (i == a.size() && j == b.size()) continue;
      if (dp[i][j] == inf) continue;
      if (i < a.size()) {
        dp[i + 1][j] = min(dp[i + 1][j], nex[dp[i][j] + 1][a[i] - 'a']);
      }
      if (j < b.size()) {
        dp[i][j + 1] = min(dp[i][j + 1], nex[dp[i][j] + 1][b[j] - 'a']);
      }
    }
  }
  if (dp[a.size()][b.size()] != inf)
    return true;
  else
    return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    cin >> s >> str;
    memset(nex, inf, sizeof(nex));
    for (int i = (s.size() - 1); i >= (0); i--) {
      for (int j = (0); j <= (26); j++) nex[i][j] = nex[i + 1][j];
      nex[i][s[i] - 'a'] = i;
    }
    bool f = false;
    for (int i = (1); i <= (str.size()); i++) {
      a = str.substr(0, i);
      b = str.substr(i, str.size() - i);
      if (check()) {
        f = true;
        break;
      }
    }
    cout << (f ? "YES" : "NO") << '\n';
  }
  return 0;
}
