#include <bits/stdc++.h>
long long mpow(long long a, long long n, long long mod) {
  long long ret = 1;
  long long b = a;
  while (n) {
    if (n & 1) ret = (ret * b) % mod;
    b = (b * b) % mod;
    n >>= 1;
  }
  return (long long)ret;
}
void solve();
int dbg = 1;
using namespace std;
int main() {
  int t = 1;
  scanf("%d", &t);
  for (int i = 0; i < t; i++) {
    solve();
  }
  return 0;
}
int dp[405][405];
int nxt[405][26];
string second, t;
int sep;
int func(int a, int b) {
  if (dp[a][b] != -1) return dp[a][b];
  if (a == 0 && b == 0) return 0;
  dp[a][b] = second.length() + 1;
  if (a != 0) {
    int ans = func(a - 1, b);
    int c = t[a - 1] - 'a';
    if (ans < second.length())
      dp[a][b] = min(dp[a][b], nxt[ans][c] + 1);
    else
      dp[a][b] = min(dp[a][b], (int)second.length() + 1);
  }
  if (b != 0) {
    int ans = func(a, b - 1);
    int c = t[sep + b] - 'a';
    if (ans < second.length())
      dp[a][b] = min(dp[a][b], nxt[ans][c] + 1);
    else
      dp[a][b] = min(dp[a][b], (int)second.length() + 1);
  }
  return dp[a][b];
}
void solve() {
  cin >> second >> t;
  for (int i = 0; i < 26; i++)
    for (int j = second.length() - 1; j >= 0; j--)
      if (second[j] - 'a' == i)
        nxt[j][i] = j;
      else if (j == second.length() - 1)
        nxt[j][i] = second.length() + 1;
      else
        nxt[j][i] = nxt[j + 1][i];
  for (int i = 0; i < t.length(); i++) {
    memset(dp, -1, sizeof(dp));
    sep = i;
    if (func(i + 1, t.length() - i - 1) != second.length() + 1) {
      cout << "YES" << endl;
      return;
    }
  }
  cout << "NO" << endl;
}
