#include <bits/stdc++.h>
using namespace std;
inline long long mod(long long n, long long m) {
  long long ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long exp(long long a, long long b, long long m) {
  if (b == 0) return 1;
  if (b == 1) return mod(a, m);
  long long k = mod(exp(a, b / 2, m), m);
  if (b & 1) {
    return mod(a * mod(k * k, m), m);
  } else
    return mod(k * k, m);
}
long long dp[410][410];
long long pos[410][30];
long long n, m;
string s;
string t;
long long go(long long L) {
  for (long long i = 0; i <= L + 1; i++) {
    for (long long j = 0; j <= m; j++) {
      dp[i][j] = n + 100;
    }
  }
  dp[0][0] = 0;
  for (long long j = 1; j <= m - L; j++) {
    if (dp[0][j - 1] < n)
      dp[0][j] = pos[dp[0][j - 1]][t[j + L - 1] - 'a'] + 1;
    else
      dp[0][j] = n + 100;
  }
  for (long long i = 1; i <= L; i++) {
    for (long long j = 0; j <= m - L; j++) {
      dp[i][j] = n + 100;
      if (j == 0) {
        if (dp[i - 1][j] < n)
          dp[i][j] = pos[dp[i - 1][j]][t[i - 1] - 'a'] + 1;
        else
          dp[i][j] = n + 100;
      } else {
        if (dp[i - 1][j] < n)
          dp[i][j] = pos[dp[i - 1][j]][t[i - 1] - 'a'] + 1;
        else
          dp[i][j] = n + 100;
        if (dp[i][j - 1] < n)
          dp[i][j] = min(dp[i][j], pos[dp[i][j - 1]][t[j + L - 1] - 'a'] + 1);
      }
    }
  }
  if (dp[L][m - L] <= n) return true;
  return false;
}
void solve() {
  cin >> s;
  cin >> t;
  n = s.size();
  m = t.size();
  for (long long j = 0; j < 26; j++) {
    pos[n][j] = n + 100;
  }
  for (long long i = n - 1; i >= 0; i--) {
    for (long long j = 0; j < 26; j++) {
      pos[i][j] = pos[i + 1][j];
    }
    pos[i][s[i] - 'a'] = i;
  }
  for (long long i = 0; i < m; i++) {
    if (go(i)) {
      cout << "YES"
           << "\n";
      return;
    }
  }
  cout << "NO"
       << "\n";
  return;
}
int32_t main() {
  long long T;
  cin >> T;
  while (T--) {
    solve();
  }
}
