#include <bits/stdc++.h>
using namespace std;
int dp[405];
char s[405], t[405];
int main() {
  int cas;
  cin >> cas;
  while (cas--) {
    scanf("%s%s", s + 1, t + 1);
    int n = strlen(s + 1), m = strlen(t + 1);
    int ok = 0;
    for (int h = 0; h <= m; h++) {
      for (int i = 1; i <= n; i++) dp[i] = -1;
      dp[h] = 0;
      for (int i = 1; i <= n; i++) {
        for (int j = m; j >= h; j--) {
          if (dp[j] == -1) continue;
          if (j < m && s[i] == t[j + 1]) dp[j + 1] = max(dp[j + 1], dp[j]);
          if (dp[j] < h && s[i] == t[dp[j] + 1]) dp[j]++;
        }
      }
      if (dp[m] == h) ok = 1;
    }
    if (ok)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
