#include <bits/stdc++.h>
using ld = long double;
using namespace std;
const double eps = (1e-11);
const long long INF = 2e17 + 9;
const int logn = 21;
const double pi = acos(-1.0);
int pp = INT_MAX;
long long dp[405][405];
char s[2001];
char t[2001];
long long LCS(char *a1, char *a2, char *a3, long long n, long long m,
              long long l) {
  for (long long i = 0; i <= n; i++) {
    dp[i][0] = 0;
    for (long long j = 1; j <= m; j++) {
      dp[i][j] = -1;
    }
  }
  for (long long i = 1; i <= n; i++) {
    dp[i][0] = dp[i - 1][0];
    if (a1[i - 1] == a3[dp[i - 1][0]]) dp[i][0]++;
    for (long long j = 1; j <= m; j++) {
      long long up = 0;
      if (dp[i - 1][j] != -1) {
        if (a1[i - 1] == a3[dp[i - 1][j]]) {
          up = 1;
        }
        dp[i][j] = dp[i - 1][j] + up;
      }
      if (a1[i - 1] == a2[j - 1]) {
        if (dp[i - 1][j - 1] == -1) {
          dp[i][j] = -1;
        } else if (dp[i - 1][j] != -1)
          dp[i][j] = max(dp[i][j], dp[i - 1][j - 1]);
        else
          dp[i][j] = dp[i - 1][j - 1];
      }
    }
  }
  if (dp[n][m] == l) return true;
  return false;
}
signed main() {
  long long tt;
  scanf("%lld", &tt);
  while (tt--) {
    scanf("%s", s);
    scanf("%s", t);
    long long n = strlen(s);
    long long m = strlen(t);
    for (long long i = 1; i < m; i++) {
      if (LCS(s, t, t + i, n, i, m - i)) {
        printf("YES\n");
        goto L;
      }
    }
    for (long long i = 0; i <= n; i++) {
      dp[i][0] = 0;
      for (long long j = 1; j <= m; j++) {
        dp[i][j] = 0;
      }
    }
    for (long long i = 1; i <= n; i++) {
      for (long long j = 1; j <= m; j++) {
        dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
        if (s[i - 1] == t[j - 1])
          dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 1);
      }
    }
    if (dp[n][m] == m) {
      printf("YES\n");
      goto L;
    }
    printf("NO\n");
  L:;
  }
  return 0;
}
