#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 5;
int n, m, k;
int pos[405], nex[405][405];
int ans, tmp, cnt;
int flag, l1, l2;
char s[maxn], t[maxn];
int dp[405][405];
int jud(int pos) {
  for (register int i = (0); i <= (l2); i++)
    for (register int j = (0); j <= (l2); j++) dp[i][j] = 0x3f3f3f3f;
  dp[1][pos] = nex[0][t[0] - 'a'];
  dp[0][pos + 1] = nex[0][t[pos] - 'a'];
  for (register int i = (0); i <= (pos); i++) {
    for (register int j = (pos); j <= (l2); j++) {
      if (dp[i][j] != 0x3f3f3f3f) {
        if (i < pos)
          dp[i + 1][j] =
              min(dp[i + 1][j], max(dp[i][j], nex[dp[i][j] + 1][t[i] - 'a']));
        if (j < l2)
          dp[i][j + 1] =
              min(dp[i][j + 1], max(dp[i][j], nex[dp[i][j] + 1][t[j] - 'a']));
      }
    }
  }
  if (pos == 1) {
  }
  if (dp[pos][l2] != 0x3f3f3f3f) return 1;
  return 0;
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%s%s", s, t);
    l1 = strlen(s);
    l2 = strlen(t);
    int i = 0, j = 0;
    while (i < l1 && j < l2) {
      if (s[i] == t[j]) j++;
      i++;
    }
    if (j == l2) {
      puts("YES");
      continue;
    }
    for (register int i = (0); i <= (26); i++) pos[i] = 0x3f3f3f3f;
    for (register int i = (l1); i >= (0); i--) {
      if (i < l1) pos[s[i] - 'a'] = i;
      for (register int j = (0); j <= (25); j++) nex[i][j] = pos[j];
    }
    int fg = 0;
    for (register int i = (0); i <= (l2 - 1); i++) {
      fg |= jud(i);
      if (fg) {
        break;
      }
    }
    if (fg)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
