#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 4e2 + 10;
const int inf = 0x3f3f3f3f;
int f[maxn][maxn];
string s, t;
bool check(string t1, string t2) {
  int n = s.length(), n1 = t1.length(), n2 = t2.length();
  memset(f, -1, sizeof(f));
  f[0][0] = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= n1; ++j) {
      if (f[i][j] == -1) continue;
      f[i + 1][j] = max(f[i + 1][j], f[i][j]);
      if (j < n1 && s[i] == t1[j])
        f[i + 1][j + 1] = max(f[i + 1][j + 1], f[i][j]);
      if (f[i][j] < n2 && s[i] == t2[f[i][j]])
        f[i + 1][j] = max(f[i + 1][j], f[i][j] + 1);
    }
  }
  return f[n][n1] >= n2;
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    cin >> s >> t;
    int flag = 0;
    for (int i = 0; i < t.size(); ++i) {
      if (check(t.substr(0, i), t.substr(i, t.size() - i))) {
        flag = 1;
        break;
      }
    }
    if (flag)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
