#include <bits/stdc++.h>
using namespace std;
const int M = 405;
int dp[M][M], n, m;
char S[M], T[M];
bool solve() {
  scanf("%s", S + 1);
  scanf("%s", T + 1);
  int n = strlen(S + 1);
  int m = strlen(T + 1);
  int s1 = 0;
  for (int s2 = 1; s2 <= m; ++s2) {
    memset(dp, -1, sizeof(dp));
    int l1 = s2 - s1, l2 = m - s2;
    dp[0][0] = 0;
    for (int i = 1; i <= n; ++i)
      for (int a = 0; a <= l1; ++a)
        if (~dp[i - 1][a]) {
          int b = dp[i - 1][a];
          if (a < l1 && S[i] == T[s1 + a + 1])
            dp[i][a + 1] = max(dp[i][a + 1], b);
          if (b < l2 && S[i] == T[s2 + b + 1]) dp[i][a] = max(dp[i][a], b + 1);
          dp[i][a] = max(dp[i][a], b);
        }
    if (dp[n][l1] == l2) return 1;
  }
  return 0;
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    if (solve())
      printf("YES\n");
    else
      printf("NO\n");
  }
}
