#include <bits/stdc++.h>
using namespace std;
string s, t;
int dp[405][405];
int nxt[405][30];
int main() {
  int tc;
  cin >> tc;
  int ns, nt;
  int idx, ii, jj;
  bool flag;
  while (tc--) {
    cin >> s >> t;
    flag = false;
    ns = s.size(), nt = t.size();
    if (nt > ns) {
      cout << "NO\n";
      continue;
    }
    for (int i = 0; i < 30; i++) nxt[ns][i] = -1;
    for (int i = ns - 1; i >= 0; i--) {
      for (int j = 0; j < 30; j++) nxt[i][j] = nxt[i + 1][j];
      nxt[i][s[i] - 'a'] = i;
    }
    for (int mid = 1; mid <= nt; mid++) {
      for (int i = 0; i <= mid; i++) {
        for (int j = mid; j <= nt; j++) dp[i][j] = 2000000005;
      }
      dp[0][mid] = 0;
      int x;
      for (int i = 0; i <= mid; i++) {
        for (int j = mid; j <= nt; j++) {
          if (dp[i][j] == 2000000005) continue;
          x = nxt[dp[i][j]][t[i] - 'a'];
          if (x != -1) dp[i + 1][j] = min(dp[i + 1][j], x + 1);
          x = nxt[dp[i][j]][t[j] - 'a'];
          if (x != -1) dp[i][j + 1] = min(dp[i][j + 1], x + 1);
        }
      }
      if (dp[mid][nt] != 2000000005) {
        flag = true;
        break;
      }
    }
    if (flag)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
