#include <bits/stdc++.h>
using namespace std;
int t, memo[402][402][402], idx, n, m;
string x, y;
void read(string &s) {
  char c[404];
  scanf("%s", c);
  s = c;
}
int dp(int i, int j, int k) {
  if (i == n) {
    if (k == m)
      return j;
    else
      return -10;
  }
  int &ret = memo[i][j][k];
  if (ret != -1) return ret;
  ret = dp(i + 1, j, k);
  if (j < m) {
    if (x[i] == y[j]) {
      ret = max(ret, dp(i + 1, j + 1, k));
    }
  }
  if (k < m) {
    if (x[i] == y[k]) {
      ret = max(ret, dp(i + 1, j, k + 1));
    }
  }
  return ret;
}
int main() {
  scanf("%d", &t);
  while (t--) {
    read(x);
    read(y);
    n = x.size();
    m = y.size();
    for (int i = 0; i < n + 2; i++) {
      for (int j = 0; j < m + 2; j++) {
        for (int k = 0; k < m + 2; k++) {
          memo[i][j][k] = -1;
        }
      }
    }
    bool b = 0;
    for (int i = 0; i < m; i++) {
      idx = dp(0, 0, i);
      if (i <= idx) {
        b = 1;
        break;
      }
    }
    b ? printf("YES\n") : printf("NO\n");
  }
}
