#include <bits/stdc++.h>
using namespace std;
const long long N = 403, inf = 10000;
string s, t;
long long n, m;
long long nxt[N][26];
long long dp[N][N];
void doit(long long a) {
  for (long long i = 0; i <= a; ++i) {
    for (long long j = 0; j <= (m - a); ++j) {
      if (i > 0 && dp[i - 1][j] < inf) {
        long long c = t[i - 1] - 'a';
        long long cand = nxt[dp[i - 1][j]][c];
        dp[i][j] = min(dp[i][j], cand);
      }
      if (j > 0 && dp[i][j - 1] < inf) {
        long long c = t[j - 1 + a] - 'a';
        long long cand = nxt[dp[i][j - 1]][c];
        dp[i][j] = min(dp[i][j], cand);
      }
    }
  }
}
bool solve() {
  for (long long i = 0; i <= n; ++i) {
    for (long long j = 0; j < 26; ++j) {
      nxt[i][j] = inf;
    }
  }
  for (long long i = n - 1; i >= 0; --i) {
    char c = s[i];
    long long ci = c - 'a';
    for (long long j = 0; j < 26; ++j) {
      nxt[i][j] = nxt[i + 1][j];
    }
    nxt[i][ci] = i + 1;
  }
  for (long long a = 0; a < m; ++a) {
    for (long long i = 0; i <= a; ++i) {
      for (long long j = 0; j <= (m - a); ++j) {
        dp[i][j] = inf;
      }
    }
    dp[0][0] = 0;
    doit(a);
    if (dp[a][m - a] < inf) {
      return true;
    }
  }
  return false;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long q;
  cin >> q;
  while (q--) {
    cin >> s >> t;
    n = s.length();
    m = t.length();
    if (solve()) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
  return 0;
}
