#include <bits/stdc++.h>
using namespace std;
const int MAXN = 410;
int tu, n, m, dp[MAXN][MAXN], nx[MAXN][27];
char s[MAXN], t[MAXN];
bool chk(int x) {
  for (int i = 0; i <= x - 1; i++) {
    for (int j = x - 1; j <= m; j++) {
      if (i == 0 && j == x - 1) {
        dp[i][j] = 0;
        continue;
      }
      if (i == 0) {
        dp[i][j] = nx[dp[i][j - 1]][t[j] - 'a' + 1];
        continue;
      }
      if (j == x - 1) {
        dp[i][j] = nx[dp[i - 1][j]][t[i] - 'a' + 1];
        continue;
      }
      dp[i][j] = min(nx[dp[i - 1][j]][t[i] - 'a' + 1],
                     nx[dp[i][j - 1]][t[j] - 'a' + 1]);
    }
  }
  return (dp[x - 1][m] <= n);
}
int main() {
  scanf("%d", &tu);
  for (int ii = 1; ii <= tu; ii++) {
    scanf("%s%s", s + 1, t + 1);
    n = strlen(s + 1), m = strlen(t + 1);
    memset(nx, 0, sizeof(nx));
    for (int j = 1; j <= 26; j++) {
      nx[n][j] = nx[n + 1][j] = n + 1;
    }
    for (int i = n - 1; i >= 0; i--) {
      for (int j = 1; j <= 26; j++) {
        nx[i][j] = nx[i + 1][j];
      }
      nx[i][s[i + 1] - 'a' + 1] = i + 1;
    }
    int flg = 0;
    for (int i = 1; i <= m + 1; i++) {
      if (chk(i)) {
        printf("YES\n");
        flg = 1;
        break;
      }
    }
    if (!flg) {
      printf("NO\n");
    }
  }
  return 0;
}
