#include <bits/stdc++.h>
using namespace std;
const int N = 405;
const int INF = 0x3f3f3f3f;
template <typename T>
inline void read(T &AKNOI) {
  T x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  AKNOI = flag * x;
}
template <typename T>
inline void cmax(T &x, T y) {
  if (x < y) x = y;
}
char s[N], t[N];
int n, m, dp[N][N];
void init() {
  scanf("%s", s + 1);
  scanf("%s", t + 1);
  n = strlen(s + 1);
  m = strlen(t + 1);
}
bool solve() {
  for (int k = 1; k <= m; ++k) {
    for (int i = 0; i <= n; ++i) {
      for (int j = 0; j <= m; ++j) {
        dp[i][j] = -INF;
      }
    }
    dp[0][0] = 0;
    for (int i = 1; i <= n; ++i) {
      for (int j = 0; j <= k; ++j) {
        int x = dp[i - 1][j];
        if (x < 0) continue;
        cmax(dp[i][j], x);
        if (j < k && s[i] == t[j + 1]) {
          cmax(dp[i][j + 1], x);
        }
        if (x < m - k && s[i] == t[k + x + 1]) {
          cmax(dp[i][j], x + 1);
        }
      }
    }
    if (dp[n][k] == m - k) return 1;
  }
  return 0;
}
int main() {
  int T;
  read(T);
  while (T--) {
    init();
    puts(solve() ? "YES" : "NO");
  }
  return 0;
}
