#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e2 + 10;
const int inf = 0x3f3f3f3f;
char s[maxn], t[maxn];
int n, m;
int dp[maxn][maxn];
bool check(char* a, char* b, int k) {
  for (int j = 0; j <= k; j++) dp[0][j] = -inf;
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[i][j] = dp[i - 1][j];
      if (j > 0 && s[i] == a[j]) dp[i][j] = max(dp[i][j], dp[i - 1][j - 1]);
      if (dp[i - 1][j] >= 0 && dp[i - 1][j] < m - k &&
          s[i] == b[dp[i - 1][j] + 1])
        dp[i][j] = max(dp[i][j], dp[i - 1][j] + 1);
    }
  }
  return dp[n][k] == m - k;
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    scanf("%s%s", s + 1, t + 1);
    n = strlen(s + 1), m = strlen(t + 1);
    int ok = 0;
    for (int i = 0; i <= m; i++) {
      if (check(t, t + i, i)) {
        ok = 1;
        break;
      }
    }
    if (ok)
      puts("YES");
    else
      puts("NO");
  }
}
