#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
int test, n;
vector<vector<int>> nxt;
int dp[402][402];
bool sol(string a, string b) {
  dp[0][0] = -1;
  for (int i = 0; i <= (int)a.size(); i++) {
    for (int j = 0; j <= (int)b.size(); j++) {
      if (!i && !j) continue;
      dp[i][j] = n;
      if (i) dp[i][j] = min(dp[i][j], nxt[dp[i - 1][j] + 1][a[i - 1] - 'a']);
      if (j) dp[i][j] = min(dp[i][j], nxt[dp[i][j - 1] + 1][b[j - 1] - 'a']);
    }
  }
  return dp[(int)a.size()][(int)b.size()] < n;
}
void solve() {
  string s, t;
  cin >> s >> t;
  n = s.size();
  nxt.assign(402, vector<int>(26, inf));
  for (int i = n - 1; i >= 0; i--) {
    nxt[i] = nxt[i + 1];
    nxt[i][(int)s[i] - 'a'] = i;
  }
  int m = t.size();
  for (int i = 0; i < (m); i++)
    if (sol(t.substr(0, i), t.substr(i))) {
      cout << "YES"
           << "\n";
      return;
    }
  cout << "NO"
       << "\n";
  return;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> test;
  while (test--) solve();
  return 0;
}
