#include <bits/stdc++.h>
using namespace std;
const double PI = 3.1415926535898;
const double E = 2.718281828459;
const int INF = 0x7fffffff;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 10;
int f[410];
int main(int argc, const char *argv[]) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    string s, t;
    cin >> s >> t;
    int ls = s.length();
    int lt = t.length();
    int fl = 0;
    for (int p = 0; p < lt && (!fl); p++) {
      memset(f, -1, sizeof(f));
      f[p] = 0;
      for (int i = 0; i < ls; i++) {
        for (int j = lt; j >= p; j--) {
          if (f[j] < 0) continue;
          if (j < lt && s[i] == t[j]) f[j + 1] = max(f[j + 1], f[j]);
          if (f[j] < p && s[i] == t[f[j]]) f[j]++;
        }
      }
      if (f[lt] >= p) fl = 1;
    }
    if (fl)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
