#include <bits/stdc++.h>
using namespace std;
const int maxn = 405;
const int inf = 0x3f3f3f3f;
char s[maxn], t[maxn];
char t1[maxn], t2[maxn];
int f[maxn][maxn];
bool check() {
  int len = (int)strlen(s + 1);
  int t1_len = (int)strlen(t1 + 1);
  f[0][0] = 0;
  for (int i = 1; i <= len; i++) {
    for (int j = 0; j <= min(i, t1_len); j++) {
      f[i][j] = -inf;
      if (i > j && f[i - 1][j] >= 0) {
        int tmp = f[i - 1][j] + 1;
        int x = t2[tmp] == s[i] ? 1 : 0;
        f[i][j] = max(f[i][j], f[i - 1][j] + x);
      }
      if (j > 0 && t1[j] == s[i]) {
        f[i][j] = max(f[i][j], f[i - 1][j - 1]);
      }
    }
  }
  return f[len][t1_len] == strlen(t2 + 1);
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%s%s", s + 1, t + 1);
    int len = (int)strlen(t + 1);
    bool ok = false;
    for (int i = 1; i <= len; i++) {
      for (int j = 1; j < i; j++) {
        t1[j] = t[j];
      }
      t1[i] = '\0';
      for (int j = i; j <= len; j++) {
        t2[j - i + 1] = t[j];
      }
      t2[len - i + 2] = '\0';
      if (check()) {
        ok = true;
        break;
      }
    }
    if (ok) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
  return 0;
}
