You are given a string s. You can build new string p from s using the following operation no more than two times: 

  1. choose any subsequence s_{i_1}, s_{i_2}, ..., s_{i_k} where 1 ≤ i_1 < i_2 < ... < i_k ≤ |s|; 
  2. erase the chosen subsequence from s (s can become empty); 
  3. concatenate chosen subsequence to the right of the string p (in other words, p = p + s_{i_1}s_{i_2}... s_{i_k}). 



Of course, initially the string p is empty. 

For example, let s = ababcd. At first, let's choose subsequence s_1 s_4 s_5 = abc — we will get s = bad and p = abc. At second, let's choose s_1 s_2 = ba — we will get s = d and p = abcba. So we can build abcba from ababcd.

Can you build a given string t using the algorithm above?

Input

The first line contains the single integer T (1 ≤ T ≤ 100) — the number of test cases.

Next 2T lines contain test cases — two per test case. The first line contains string s consisting of lowercase Latin letters (1 ≤ |s| ≤ 400) — the initial string.

The second line contains string t consisting of lowercase Latin letters (1 ≤ |t| ≤ |s|) — the string you'd like to build.

It's guaranteed that the total length of strings s doesn't exceed 400.

Output

Print T answers — one per test case. Print YES (case insensitive) if it's possible to build t and NO (case insensitive) otherwise.

Example

Input


4
ababcd
abcba
a
b
defi
fed
xyz
x


Output


YES
NO
NO
YES
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const double eps = 1e-9;
const long long INF = 0x3f3f3f3f3f3f3f3fll;
const int inf = 0x3f3f3f3f;
inline int read() {
  int ret = 0, sgn = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') sgn = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    ret = ret * 10 + ch - '0';
    ch = getchar();
  }
  return ret * sgn;
}
inline void Out(int a) {
  if (a > 9) Out(a / 10);
  putchar(a % 10 + '0');
}
long long __gcd(long long a, long long b) {
  return b == 0 ? a : __gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * b / __gcd(a, b); }
long long qpow(long long a, long long b, long long mod) {
  if (a >= mod) a = a % mod + mod;
  long long ans = 1;
  while (b) {
    if (b & 1) {
      ans = ans * a;
      if (ans >= mod) ans = ans % mod + mod;
    }
    a *= a;
    if (a >= mod) a = a % mod + mod;
    b >>= 1;
  }
  return ans;
}
int Fermat(int a, int p) { return qpow(a, p - 2, p); }
int exgcd(int a, int b, int &x, int &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  int g = exgcd(b, a % b, x, y);
  int t = x;
  x = y;
  y = t - a / b * y;
  return g;
}
int mod_reverse(int a, int p) {
  int d, x, y;
  d = exgcd(a, p, x, y);
  if (d == 1)
    return (x % p + p) % p;
  else
    return -1;
}
long long china(int a[], int b[], int n) {
  int M = 1, y, x = 0;
  for (int i = 0; i < n; ++i) M *= a[i];
  for (int i = 0; i < n; ++i) {
    int w = M / a[i];
    int tx = 0;
    int t = exgcd(w, a[i], tx, y);
    x = (x + w * (b[i] / t) * x) % M;
  }
  return (x + M) % M;
}
const int N = 1000;
char s1[N], s2[N];
int a[N][26];
int f[N][N];
int len1, len2;
bool flag;
void cal(char *s, char *t, int n, int m) {
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++) {
      if (!i && !j) continue;
      f[i][j] = INF;
      if (i && f[i - 1][j] < inf)
        f[i][j] = min(f[i][j], a[f[i - 1][j]][s[i] - 'a']);
      if (j && f[i][j - 1] < inf)
        f[i][j] = min(f[i][j], a[f[i][j - 1]][t[j] - 'a']);
    }
  return;
}
void slove() {
  for (int i = 0; i <= len1; i++) {
    for (int j = 0; j <= 25; j++) {
      a[i][j] = inf;
      for (int k = i + 1; k <= len1; k++) {
        if (s1[k] == 'a' + j) {
          a[i][j] = k;
          break;
        }
      }
    }
  }
  flag = 0;
  for (int i = 1; i <= len2; i++) {
    cal(s2, s2 + i, i, len2 - i);
    if (f[i][len2 - i] < inf) {
      flag = 1;
      break;
    }
  }
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%s", s1 + 1);
    scanf("%s", s2 + 1);
    len1 = strlen(s1 + 1);
    len2 = strlen(s2 + 1);
    slove();
    if (flag)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
