#include <bits/stdc++.h>
using namespace std;
char s[405], t[405];
int f[2][405][405];
int main() {
  int T;
  cin >> T;
  while (T--) {
    scanf("%s%s", s + 1, t + 1);
    int lens = strlen(s + 1), lent = strlen(t + 1);
    int cur = 0, pre = 1;
    memset(f, -63, sizeof f);
    for (int i = 0; i < lent; ++i) f[cur][0][i] = 0;
    for (int i = 1; i <= lens; ++i) {
      swap(cur, pre);
      for (int j = 0; j <= lent; ++j)
        for (int k = j; k <= lent; ++k) {
          f[cur][j][k] = f[pre][j][k];
          if (j && s[i] == t[j])
            f[cur][j][k] = max(f[cur][j][k], f[pre][j - 1][k]);
          if (k && s[i] == t[k])
            f[cur][j][k] = max(f[cur][j][k], f[pre][j][k - 1] + 1);
        }
    }
    bool flag = false;
    for (int i = 0; i <= lent; ++i)
      if (lent - f[cur][i][lent] <= i) flag = true;
    if (flag)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
