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;
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using pii = pair<int, int>;
const bool debug = 0;
long long dp[420][420];
void print_dp_table(long long a, long long b) {
  for (long long i = 0; i <= a; i++) {
    for (long long j = 0; j <= b; j++) {
      printf("%lld ", dp[i][j] >= 1000 ? -1 : dp[i][j]);
    }
    printf("\n");
  }
}
void solve() {
  long long n;
  string s, t;
  cin >> s >> t;
  vector<long long> letter_indexes[26];
  for (long long i = 0; i < 26; i++) letter_indexes[i].push_back(-1);
  for (long long i = 0; i < s.length(); i++) {
    letter_indexes[s[i] - 'a'].push_back(i + 1);
  }
  n = t.length();
  for (long long cut = 0; cut < n; cut++) {
    string left = t.substr(0, cut);
    string right = t.substr(cut, n - cut);
    if (debug) printf("CUT String as %s : %s\n", left.c_str(), right.c_str());
    memset(dp, 0x7f, sizeof(dp));
    dp[0][0] = 0;
    for (long long i = 1; i <= cut; i++) {
      long long cur_ind = dp[i - 1][0] + 1;
      if (cur_ind > letter_indexes[left[i - 1] - 'a'].back()) continue;
      long long u =
          *lower_bound(((letter_indexes[left[i - 1] - 'a']).begin()),
                       ((letter_indexes[left[i - 1] - 'a']).end()), cur_ind);
      dp[i][0] = u;
    }
    for (long long i = 1; i <= (n - cut); i++) {
      long long cur_ind = dp[0][i - 1] + 1;
      if (cur_ind > letter_indexes[right[i - 1] - 'a'].back()) continue;
      long long u =
          *lower_bound(((letter_indexes[right[i - 1] - 'a']).begin()),
                       ((letter_indexes[right[i - 1] - 'a']).end()), cur_ind);
      dp[0][i] = u;
    }
    if (debug) printf("Start filling inner table\n");
    for (long long i = 1; i <= cut; i++) {
      for (long long j = 1; j <= (n - cut); j++) {
        long long u1 = 0x7f7f7f7f7f7f7f7f;
        long long cur_ind = dp[i - 1][j] + 1;
        if (cur_ind <= letter_indexes[left[i - 1] - 'a'].back())
          u1 = *lower_bound(((letter_indexes[left[i - 1] - 'a']).begin()),
                            ((letter_indexes[left[i - 1] - 'a']).end()),
                            cur_ind);
        long long u2 = 0x7f7f7f7f7f7f7f7f;
        long long cur2_ind = dp[i][j - 1] + 1;
        if (cur2_ind <= letter_indexes[right[j - 1] - 'a'].back())
          u2 = *lower_bound(((letter_indexes[right[j - 1] - 'a']).begin()),
                            ((letter_indexes[right[j - 1] - 'a']).end()),
                            cur2_ind);
        dp[i][j] = min(min(u1, u2), dp[i][j]);
      }
    }
    if (debug) print_dp_table(cut, n - cut);
    long long best = dp[cut][n - cut];
    if (best <= s.length()) {
      cout << "YES\n";
      return;
    }
  }
  cout << "NO\n";
  return;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) solve();
}
