#include <bits/stdc++.h>
using namespace std;
const int N = 400;
char s[N + 9], t[N + 9];
int n, m;
void into() {
  scanf("%s%s", s + 1, t + 1);
  n = strlen(s + 1);
  m = strlen(t + 1);
}
int dp[N + 9][N + 9];
void Get_dp(int p) {
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= p; ++j) dp[i][j] = -1;
  dp[0][0] = p;
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j <= p; ++j) {
      dp[i][j] = dp[i - 1][j];
      if (j && s[i] == t[j]) dp[i][j] = max(dp[i][j], dp[i - 1][j - 1]);
      if (dp[i - 1][j] ^ -1 && s[i] == t[dp[i - 1][j] + 1])
        dp[i][j] = max(dp[i][j], dp[i - 1][j] + 1);
    }
}
int ans;
void Get_ans() {
  ans = 0;
  for (int i = 0; i <= m; ++i) {
    Get_dp(i);
    if (dp[n][i] == m) {
      ans = 1;
      return;
    }
  }
}
void work() { Get_ans(); }
void outo() { puts(ans ? "YES" : "NO"); }
int main() {
  int T;
  scanf("%d", &T);
  for (; T--;) {
    into();
    work();
    outo();
  }
  return 0;
}
