#include <bits/stdc++.h>
using namespace std;
const int maxn = 410, maxl = 26, inf = 1e9;
int dp[maxn][maxn], nxt[maxn][maxl];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tc;
  cin >> tc;
  while (tc--) {
    string a, t;
    cin >> a >> t;
    for (int i = 0; i < (int)a.size(); i++)
      for (int j = 0; j < maxl; j++) {
        nxt[i][j] = -1;
        for (int k = i; k < (int)a.size(); k++)
          if (a[k] == j + 'a') {
            nxt[i][j] = k;
            break;
          }
      }
    bool find = false;
    for (int x = 0; x < (int)t.size(); x++) {
      string b = "", c = "";
      for (int i = 0; i < (int)t.size(); i++)
        if (i < x)
          b += t[i];
        else
          c += t[i];
      for (int i = 0; i <= (int)b.size(); i++)
        for (int j = 0; j <= (int)c.size(); j++) {
          dp[i][j] = (i + j == 0 ? 0 : inf);
          if (i > 0 && dp[i - 1][j] < (int)a.size() &&
              nxt[dp[i - 1][j]][b[i - 1] - 'a'] != -1)
            dp[i][j] = min(dp[i][j], 1 + nxt[dp[i - 1][j]][b[i - 1] - 'a']);
          if (j > 0 && dp[i][j - 1] < (int)a.size() &&
              nxt[dp[i][j - 1]][c[j - 1] - 'a'] != -1)
            dp[i][j] = min(dp[i][j], 1 + nxt[dp[i][j - 1]][c[j - 1] - 'a']);
        }
      if (dp[(int)b.size()][(int)c.size()] <= (int)a.size()) {
        find = true;
        break;
      }
    }
    cout << (find ? "YES\n" : "NO\n");
  }
  return 0;
}
