#include <bits/stdc++.h>
using namespace std;
char a[405];
char b[405];
int dp[405][405];
void work() {
  scanf("%s", a + 1);
  scanf("%s", b + 1);
  int l1 = strlen(a + 1);
  int l2 = strlen(b + 1);
  for (int i = 1; i <= l2; i++) {
    for (int j = 0; j <= l1; j++) {
      for (int k = 0; k <= min(i, j); k++) {
        dp[j][k] = -1;
      }
    }
    dp[0][0] = i;
    for (int j = 0; j < l1; j++) {
      for (int k = 0; k <= min(i, j); k++) {
        if (k < i && a[j + 1] == b[k + 1])
          dp[j + 1][k + 1] = max(dp[j + 1][k + 1], dp[j][k]);
        if (dp[j][k] < l2 && a[j + 1] == b[dp[j][k] + 1])
          dp[j + 1][k] = max(dp[j + 1][k], dp[j][k] + 1);
        dp[j + 1][k] = max(dp[j + 1][k], dp[j][k]);
      }
    }
    if (dp[l1][i] == l2) {
      printf("YES\n");
      return;
    }
  }
  printf("NO\n");
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  scanf("%d", &T);
  while (T--) {
    work();
  }
}
