#include <bits/stdc++.h>
using namespace std;
const int N = 400 + 5;
const int INF = 0x3f3f3f3f;
const long long INF_LL = 0x3f3f3f3f3f3f3f3f;
int f[N][N];
char s[N], t[N];
int n, m;
bool DP(int pos) {
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) f[i][j] = -INF;
  f[0][0] = 0;
  int t1 = pos - 1;
  int t2 = m - t1;
  for (int i = 1; i <= n; i++) {
    memcpy(f[i], f[i - 1], sizeof(f[i]));
    for (int j = 0; j <= min(i, t1); j++) {
      if (j && 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] < t2 && s[i] == t[pos + f[i - 1][j]])
        f[i][j] = max(f[i][j], f[i - 1][j] + 1);
    }
  }
  return f[n][t1] == t2;
}
bool Solve() {
  scanf("%s%s", s + 1, t + 1);
  n = strlen(s + 1), m = strlen(t + 1);
  for (int i = 1; i <= m; i++)
    if (DP(i)) return 1;
  return 0;
}
int main() {
  int t;
  cin >> t;
  while (t--) cout << (Solve() ? "YES\n" : "NO\n");
  return 0;
}
