#include <bits/stdc++.h>
using namespace std;
int lens, lent, memo[405][405][405], inf = 1000000000;
char s[405], t[405];
int dp(int i, int j, int k) {
  int ret = -inf;
  if (i == lens) return ((k == lent) ? j : ret);
  if (memo[i][j][k] != -1) return memo[i][j][k];
  ret = max(ret, dp(i + 1, j, k));
  if ((j < lent) && (s[i] == t[j])) ret = max(ret, dp(i + 1, j + 1, k));
  if ((k < lent) && (s[i] == t[k])) ret = max(ret, dp(i + 1, j, k + 1));
  memo[i][j][k] = ret;
  return ret;
}
int main() {
  int tc;
  bool found;
  scanf("%d", &tc);
  while (tc--) {
    scanf("%s %s", s, t);
    lens = strlen(s);
    lent = strlen(t);
    for (int i = 0; i <= lens; i++)
      for (int j = 0; j <= lent; j++)
        for (int k = 0; k <= lent; k++) memo[i][j][k] = -1;
    found = false;
    for (int i = 0; i < lent; i++)
      if (dp(0, 0, i) >= i) {
        puts("YES");
        found = true;
        break;
      }
    if (!found) puts("NO");
  }
  return 0;
}
