#include <bits/stdc++.h>
using namespace std;
int d[402][402];
int c[402][26];
string A, B;
int n, m;
int go(string a, string b) {
  d[0][0] = -1;
  for (int i = 0; i <= a.size(); i++) {
    for (int j = 0; j <= b.size(); j++) {
      if (i == 0 && j == 0) continue;
      d[i][j] = n;
      if (i != 0) {
        d[i][j] = min(d[i][j], c[d[i - 1][j] + 1][(a[i - 1] - 'a')]);
      }
      if (j != 0) {
        d[i][j] = min(d[i][j], c[d[i][j - 1] + 1][(b[j - 1] - 'a')]);
      }
    }
  }
  if (d[a.size()][b.size()] < n) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    cin >> A >> B;
    bool f = false;
    n = A.size();
    for (int i = 0; i < 26; i++) {
      c[n][i] = n;
      c[n + 1][i] = n;
    }
    for (int i = n - 1; i >= 0; i--) {
      memcpy(c[i], c[i + 1], sizeof(c[0]));
      c[i][A[i] - 'a'] = i;
    }
    for (int i = 0; i < B.size(); i++) {
      if (go(B.substr(0, i), B.substr(i))) {
        f = true;
        cout << "YES" << '\n';
        break;
      }
    }
    if (!f) {
      cout << "NO" << '\n';
    }
  }
}
