#include <bits/stdc++.h>
using namespace std;
const int MAXN = 400;
int n, m, dp[MAXN + 5][MAXN + 5];
char s[MAXN + 5], t[MAXN + 5];
inline void ckmax(int &x, int y) { x = x > y ? x : y; }
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%s%s", s + 1, t + 1);
    n = strlen(s + 1);
    m = strlen(t + 1);
    bool ok = 0;
    for (int i = 1; i <= m; ++i) {
      memset(dp, -1, sizeof(dp));
      dp[0][0] = 0;
      for (int j = 1; j <= n; ++j) {
        for (int k = 0; k <= i; ++k) {
          if (dp[j - 1][k] != -1) {
            ckmax(dp[j][k], dp[j - 1][k] + (i + dp[j - 1][k] + 1 <= m &&
                                            s[j] == t[i + dp[j - 1][k] + 1]));
          }
          if (k >= 1 && s[j] == t[k]) {
            ckmax(dp[j][k], dp[j - 1][k - 1]);
          }
        }
      }
      if (dp[n][i] == m - i) {
        ok = 1;
        break;
      }
    }
    if (ok)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
