#include <bits/stdc++.h>
using namespace std;
int nxt[405][26];
int dp[405][405];
int n;
bool solve(string &p1, string &p2) {
  dp[0][0] = -1;
  for (int i = 0; i <= p1.size(); i++) {
    for (int j = 0; j <= p2.size(); j++) {
      if (i == 0 && j == 0) {
        continue;
      }
      dp[i][j] = n;
      if (i > 0) {
        dp[i][j] = min(dp[i][j], nxt[dp[i - 1][j] + 1][p1[i - 1] - 'a']);
      }
      if (j > 0) {
        dp[i][j] = min(dp[i][j], nxt[dp[i][j - 1] + 1][p2[j - 1] - 'a']);
      }
    }
  }
  return (dp[p1.size()][p2.size()] < n);
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s, p;
    cin >> s >> p;
    n = s.size();
    int m = p.size();
    for (int i = 0; i < 26; i++) {
      nxt[n][i] = nxt[n + 1][i] = n;
    }
    for (int i = n - 1; i >= 0; i--) {
      memcpy(nxt[i], nxt[i + 1], sizeof(nxt[0]));
      nxt[i][s[i] - 'a'] = i;
    }
    bool possible = false;
    for (int i = 0; i < m; i++) {
      string p1 = p.substr(0, i);
      string p2 = p.substr(i);
      if (solve(p1, p2)) {
        possible = true;
        break;
      }
    }
    string ans = possible ? "YES" : "NO";
    cout << ans << endl;
  }
  return 0;
}
