#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int T, dp[405][405][405], k;
string s, t;
int f(int x, int y, int z, int og) {
  if (z == s.size() && y == t.size() && x == og) return k;
  if (z == s.size()) return k - 1;
  if (dp[x][y][z] >= k - 1) return dp[x][y][z];
  int ans = 0;
  if (x != og && t[x] == s[z]) ans = max(ans, f(x + 1, y, z + 1, og));
  if (y != t.size() && t[y] == s[z]) ans = max(ans, f(x, y + 1, z + 1, og));
  ans = max(ans, f(x, y, z + 1, og));
  return dp[x][y][z] = ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> T;
  while (T--) {
    cin >> s >> t;
    bool is = false;
    k += 2;
    for (int i = 0; i < s.size(); i++) {
      int x = f(0, i, 0, i);
      if (x == k) is = 1;
    }
    if (is)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
