#include <bits/stdc++.h>
using namespace std;
char s[407], a[407];
int dp[407][407];
int ls, la, ta, oa, ob;
char geta(int i) { return a[i]; }
char getb(int i) { return a[i + ta]; }
int nxt[407][26], nt[26];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%s%s", s + 1, a + 1);
    ls = strlen(s + 1);
    la = strlen(a + 1);
    for (int j = 0; j < 26; j++) {
      nxt[405][j] = nt[j] = 405;
    }
    for (int i = ls; i >= 1; i--) {
      for (int j = 0; j < 26; j++) {
        nxt[i][j] = nt[j];
      }
      nt[s[i] - 'a'] = i;
    }
    for (int j = 0; j < 26; j++) {
      nxt[0][j] = nt[j];
    }
    int flag = 0;
    for (ta = 0; ta <= la; ta++) {
      oa = ta;
      ob = la - ta;
      for (int i = 1; i <= oa; i++) {
        dp[i][0] = nxt[dp[i - 1][0]][geta(i) - 'a'];
      }
      for (int j = 1; j <= ob; j++) {
        dp[0][j] = nxt[dp[0][j - 1]][getb(j) - 'a'];
      }
      for (int i = 1; i <= oa; i++) {
        for (int j = 1; j <= ob; j++) {
          dp[i][j] = min(nxt[dp[i - 1][j]][geta(i) - 'a'],
                         nxt[dp[i][j - 1]][getb(j) - 'a']);
        }
      }
      if (dp[oa][ob] != 405) {
        flag = 1;
        break;
      }
    }
    if (flag) {
      puts("YES");
    } else {
      puts("NO");
    }
  }
}
