#include <bits/stdc++.h>
using namespace std;
int i, i0, n, m, T, ans;
char s[405], t[405], a[405], b[405];
int lena, lenb, dp[405][405];
bool chk() {
  for (int i = 0; i <= lena; i++)
    for (int i0 = 0; i0 <= n; i0++) dp[i0][i] = INT_MIN / 2;
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int x = 0; x <= lena; x++) dp[i][x] = dp[i - 1][x];
    for (int x = lena - 1; x >= 0; x--) {
      if (a[x + 1] == s[i]) {
        dp[i][x + 1] = max(dp[i][x + 1], dp[i - 1][x]);
      }
    }
    for (int x = lena; x >= 0; x--) {
      if (dp[i - 1][x] + 1 <= lenb && dp[i - 1][x] + 1 >= 1 &&
          b[dp[i - 1][x] + 1] == s[i])
        dp[i][x] = max(dp[i][x], dp[i - 1][x] + 1);
    }
  }
  return dp[n][lena] == lenb;
}
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%s", s + 1);
    scanf("%s", t + 1);
    bool f = 0;
    n = strlen(s + 1), m = strlen(t + 1);
    for (int i = 1; i <= m; i++) {
      lena = i, lenb = m - i;
      for (int i0 = 1; i0 <= lena; i0++) a[i0] = t[i0];
      for (int i0 = 1; i0 <= lenb; i0++) b[i0] = t[lena + i0];
      if (chk()) f = 1;
    }
    if (f)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
