#include <bits/stdc++.h>
using namespace std;
const int maxn = 405;
char a[maxn], b[maxn];
int f[maxn][maxn];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%s%s", a + 1, b + 1);
    int n = strlen(a + 1), m = strlen(b + 1);
    int flag = 0;
    for (int p = 1; p <= m; p++) {
      memset(f, 0xcf, sizeof(f));
      f[0][0] = 0;
      for (int i = 1; i <= n; i++) {
        f[i][0] = 0;
        for (int j = 0; j <= min(p, i); j++) {
          f[i][j] = max(f[i - 1][j], f[i][j]);
          if (f[i][j] >= 0 && a[i] == b[p + f[i][j] + 1]) {
            f[i][j] = f[i][j] + 1;
          }
          if (j && a[i] == b[j]) {
            f[i][j] = max(f[i][j], f[i - 1][j - 1]);
          }
        }
      }
      if (f[n][p] == m - p) {
        flag = 1;
        break;
      }
    }
    if (flag)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
