#include <bits/stdc++.h>
const int MAXN = 400;
const int CS = 26;
const int INF = 0x3f3f3f3f;
using namespace std;
int dp[MAXN + 5][MAXN + 5], n, m;
char s[MAXN + 5], t[MAXN + 5];
int nxt[MAXN + 5][CS];
bool chk(int pos) {
  for (int i = 0; i <= pos; ++i) {
    for (int j = pos; j <= m; ++j) {
      dp[i][j] = INF;
    }
  }
  dp[0][pos] = 0;
  for (int i = 0; i <= pos; ++i) {
    for (int j = pos; j <= m; ++j) {
      if (dp[i][j] > n) continue;
      if (i < pos)
        dp[i + 1][j] = min(dp[i + 1][j], nxt[dp[i][j]][t[i + 1] - 'a']);
      if (j < m)
        dp[i][j + 1] = min(dp[i][j + 1], nxt[dp[i][j]][t[j + 1] - 'a']);
    }
  }
  return dp[pos][m] <= n;
}
int p[MAXN + 5];
void init() {
  scanf("%s%s", s + 1, t + 1);
  n = strlen(s + 1), m = strlen(t + 1);
  for (int c = 0; c < 26; ++c) p[c] = n + 1;
  for (int i = n; ~i; --i) {
    for (int c = 0; c < 26; ++c) nxt[i][c] = p[c];
    if (i) p[s[i] - 'a'] = i;
  }
}
int main() {
  int te;
  scanf("%d", &te);
  while (te--) {
    init();
    int cur = 1;
    for (int i = 1; i <= n; ++i) {
      if (cur > m) break;
      if (s[i] == t[cur]) ++cur;
    }
    if (cur > m) {
      puts("YES");
      continue;
    }
    bool f = false;
    for (int i = 1; i <= m; ++i) {
      if (chk(i)) {
        f = true;
        break;
      }
    }
    puts(f ? "YES" : "NO");
  }
  return 0;
}
