#include <bits/stdc++.h>
using namespace std;
int T, n, m;
int f[405][405];
char s[405];
char t[405];
void work() {
  memset(f, -1, sizeof(f));
  f[0][0] = 0;
  for (int k = 1; k <= m; k++) {
    for (int i = 1; i <= n; i++) {
      for (int j = 0; j <= k; j++) {
        f[i][j] = f[i - 1][j];
        if (j && f[i - 1][j - 1] >= 0 && s[i] == t[j]) {
          f[i][j] = max(f[i][j], f[i - 1][j - 1]);
        }
        if (f[i - 1][j] >= 0 && f[i - 1][j] + 1 <= m - k &&
            s[i] == t[k + f[i - 1][j] + 1]) {
          f[i][j] = max(f[i][j], f[i - 1][j] + 1);
        }
      }
    }
    if (f[n][k] == m - k) {
      printf("YES\n");
      return;
    }
  }
  printf("NO\n");
}
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%s%s", s + 1, t + 1);
    n = strlen(s + 1), m = strlen(t + 1);
    work();
  }
}
