#include <bits/stdc++.h>
using namespace std;
const int N = 400 + 10;
const int inf = 1000000000;
int nxt[N][30];
int cur[30];
int f[N][N];
int main() {
  string s, t, u, v;
  int n, a, b, x, y, i, j;
  cin >> n;
  while (n--) {
    cin >> s;
    cin >> t;
    if (t.size() > s.size())
      cout << "NO" << endl;
    else {
      for (i = 0; i < 26; i++) cur[i] = inf;
      for (i = s.size() - 1; i >= 0; i--) {
        for (j = 0; j < 26; j++) nxt[i + 1][j] = cur[j];
        cur[s[i] - 'a'] = i + 1;
      }
      for (j = 0; j < 26; j++) nxt[0][j] = cur[j];
      for (a = 1; a <= t.size(); a++) {
        b = t.size() - a;
        u = t.substr(0, a);
        if (a < t.size())
          v = t.substr(a, b);
        else
          v = "";
        f[0][0] = 0;
        for (i = 1; i <= a; i++) {
          x = f[i - 1][0];
          if (x != inf)
            f[i][0] = nxt[x][u[i - 1] - 'a'];
          else
            f[i][0] = inf;
        }
        for (i = 1; i <= b; i++) {
          x = f[0][i - 1];
          if (x != inf)
            f[0][i] = nxt[x][v[i - 1] - 'a'];
          else
            f[0][i] = inf;
        }
        for (i = 1; i <= a; i++)
          for (j = 1; j <= b; j++) {
            x = f[i - 1][j];
            if (x != inf) x = nxt[x][u[i - 1] - 'a'];
            y = f[i][j - 1];
            if (y != inf) y = nxt[y][v[j - 1] - 'a'];
            f[i][j] = min(x, y);
          }
        if (f[a][b] != inf) break;
      }
      if (a <= t.size())
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
  return 0;
}
