#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
int T, n, m, num1[30], num2[30], dp[450][450];
char s[maxn], t[maxn];
bool ck(int a, int b, int c, int d) {
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= b; j++) dp[i][j] = 0;
  dp[0][0] = c - 1;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= b; j++) {
      if (i - 1 >= 0)
        dp[i][j] = max(dp[i][j], dp[i - 1][j] + (s[i] == t[dp[i - 1][j] + 1]));
      if (j - 1 >= 0 && s[i] == t[j])
        dp[i][j] = max(dp[i][j], dp[i - 1][j - 1]);
    }
  return dp[n][b] >= d;
  return 0;
}
bool ok() {
  int p = 0;
  for (int i = 1; i <= n; ++i)
    if (p + 1 <= m && s[i] == t[p + 1]) p++;
  if (p == m) return 1;
  for (int i = 1; i <= 28; ++i) num1[i] = num2[i] = 0;
  for (int i = 1; i <= n; ++i) num1[s[i] - 'a' + 1]++;
  for (int i = 1; i <= m; ++i) {
    num2[t[i] - 'a' + 1]++;
    if (num2[t[i] - 'a' + 1] > num1[t[i] - 'a' + 1]) return 0;
  }
  for (int i = 1; i < m; ++i)
    if (ck(1, i, i + 1, m)) return 1;
  return 0;
}
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%s%s", s + 1, t + 1);
    n = strlen(s + 1);
    m = strlen(t + 1);
    printf((ok() ? "YES\n" : "NO\n"));
  }
  return 0;
}
