#include <bits/stdc++.h>
using namespace std;
char s[1000], t[1000];
int f[405], g[405];
int main() {
  int tc;
  scanf("%d", &tc);
  while (tc--) {
    scanf("%s%s", s, t);
    int n = strlen(s);
    int m = strlen(t);
    bool ans = false;
    for (int p = 0; p < m; p++) {
      vector<char> v1, v2;
      for (int i = 0; i <= p; i++) v1.push_back(t[i]);
      for (int i = p + 1; i < m; i++) v2.push_back(t[i]);
      memset(f, 0xff, sizeof f);
      f[0] = 0;
      for (int i = 0; i < n; i++) {
        memcpy(g, f, sizeof g);
        for (int j = 0; j <= v1.size(); j++) {
          if (f[j] >= 0 && j < v1.size() && s[i] == v1[j])
            g[j + 1] = max(g[j + 1], f[j]);
          if (f[j] >= 0 && f[j] < v2.size() && s[i] == v2[f[j]])
            g[j] = max(g[j], f[j] + 1);
        }
        memcpy(f, g, sizeof f);
      }
      if (f[v1.size()] == v2.size()) {
        ans = true;
        break;
      }
    }
    puts(ans ? "YES" : "NO");
  }
  return 0;
}
