#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(T a) {
  for (auto x : a) cout << x << ' ';
  cout << endl;
}
const int INF = 1e9 + 9;
void solve() {
  string s, t;
  cin >> s >> t;
  int n = (int)(s).size();
  vector<vector<int> > nxt(n + 1, vector<int>(26));
  for (int i = 0; i < n + 1; i++) {
    for (int j = 0; j < 26; j++) {
      nxt[i][j] = INF;
      for (int k = i; k < n; k++) {
        if (s[k] == ('a' + j)) {
          nxt[i][j] = k;
          break;
        }
      }
    }
  }
  bool ans = false;
  for (int p = 1; p < (int)(t).size(); p++) {
    int dp[p + 1][(int)(t).size() - p + 1];
    for (int i = 0; i < p + 1; i++)
      for (int j = 0; j < (int)(t).size() - p + 1; j++) dp[i][j] = INF;
    dp[0][0] = -1;
    for (int i = 0; i < p + 1; i++) {
      for (int j = 0; j < (int)(t).size() - p + 1; j++) {
        int current = dp[i][j];
        if (current == INF) continue;
        if (i != p) {
          int next = nxt[current + 1][t[i] - 'a'];
          dp[i + 1][j] = min(dp[i + 1][j], next);
        }
        if ((j != (int)(t).size() - p)) {
          int next = nxt[current + 1][t[p + j] - 'a'];
          dp[i][j + 1] = min(dp[i][j + 1], next);
        }
      }
    }
    if (dp[p][(int)(t).size() - p] != INF) {
      ans = true;
      break;
    }
  }
  if ((int)(t).size() == 1) {
    for (int i = 0; i < (int)(s).size(); i++) {
      if (s[i] == t[0]) {
        ans = true;
        break;
      }
    }
  }
  cout << (ans ? "YES" : "NO") << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) solve();
  return 0;
}
