#include <bits/stdc++.h>
using namespace std;
const int maxn = 400 + 10;
int T, n, m, f[maxn][maxn];
char a[maxn], b[maxn];
bool check(int x) {
  for (int i = 0; i < maxn; ++i)
    for (int j = 0; j < maxn; ++j) f[i][j] = -1e9;
  f[0][0] = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j <= x; ++j) {
      f[i][j] = f[i - 1][j];
      if (j > 0 && a[i] == b[j]) f[i][j] = max(f[i][j], f[i - 1][j - 1]);
      if (f[i - 1][j] >= 0 && a[i] == b[x + f[i - 1][j] + 1])
        f[i][j] = max(f[i][j], f[i - 1][j] + 1);
    }
  return f[n][x] == m - x;
}
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%s%s", a + 1, b + 1);
    n = strlen(a + 1), m = strlen(b + 1);
    bool flag = 0;
    for (int i = 1; i <= m; ++i)
      if (check(i)) {
        flag = 1;
        break;
      }
    if (!flag)
      puts("NO");
    else
      puts("YES");
  }
  return 0;
}
