#include <bits/stdc++.h>
using namespace std;
void read(int &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -f;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  x *= f;
}
void print(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (!x) return;
  print(x / 10), putchar(x % 10 + 48);
}
void write(int x) {
  if (!x)
    putchar('0');
  else
    print(x);
  putchar('\n');
}
const int maxn = 400 + 10;
const int inf = 1e9;
const double eps = 1e-8;
const int mod = 1e9 + 7;
char s[maxn], t[maxn];
int f[maxn][maxn], nxt[maxn][26];
int n, m;
void update(int &x, int y) {
  if (y < x) x = y;
}
int check(int r) {
  for (int i = 0; i <= r; i++)
    for (int j = 0; j <= m - r; j++) f[i][j] = inf;
  f[0][0] = 0;
  for (int i = 0; i <= r; i++)
    for (int j = 0; j <= m - r; j++) {
      if (f[i][j] == inf) continue;
      if (i != r) update(f[i + 1][j], nxt[f[i][j]][t[i + 1] - 'a']);
      if (j != m - r) update(f[i][j + 1], nxt[f[i][j]][t[r + j + 1] - 'a']);
    }
  return f[r][m - r] != inf;
}
void solve() {
  scanf("%s%s", s + 1, t + 1);
  n = strlen(s + 1), m = strlen(t + 1);
  for (int i = 0; i < 26; i++) nxt[n][i] = inf;
  for (int i = n - 1; ~i; i--)
    for (int j = 0; j < 26; j++)
      if (s[i + 1] == j + 'a')
        nxt[i][j] = i + 1;
      else
        nxt[i][j] = nxt[i + 1][j];
  for (int i = 0; i <= m; i++)
    if (check(i)) return puts("YES"), void();
  puts("NO");
}
int main() {
  int t;
  read(t);
  while (t--) solve();
  return 0;
}
