description: You are given two strings s and t, both consisting of lowercase English letters. You are going to type the string s character by character, from the first character to the last one.
  
  When typing a character, instead of pressing the button corresponding to it, you can press the "Backspace" button. It deletes the last character you have typed among those that aren't deleted yet (or does nothing if there are no characters in the current string). For example, if s is "abcbd" and you press Backspace instead of typing the first and the fourth characters, you will get the string "bd" (the first press of Backspace deletes no character, and the second press deletes the character 'c'). Another example, if s is "abcaa" and you press Backspace instead of the last two letters, then the resulting text is "a".
  
  Your task is to determine whether you can obtain the string t, if you type the string s and press "Backspace" instead of typing several (maybe zero) characters of s.
  
  Input
  
  The first line contains a single integer q (1 ≤ q ≤ 10^5) — the number of test cases.
  
  The first line of each test case contains the string s (1 ≤ |s| ≤ 10^5). Each character of s is a lowercase English letter.
  
  The second line of each test case contains the string t (1 ≤ |t| ≤ 10^5). Each character of t is a lowercase English letter.
  
  It is guaranteed that the total number of characters in the strings over all test cases does not exceed 2 ⋅ 10^5.
  
  Output
  
  For each test case, print "YES" if you can obtain the string t by typing the string s and replacing some characters with presses of "Backspace" button, or "NO" if you cannot.
  
  You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer).
  
  Example
  
  Input
  
  
  4
  ababa
  ba
  ababa
  bb
  aaa
  aaaa
  aababa
  ababa
  
  
  Output
  
  
  YES
  NO
  NO
  YES
  
  Note
  
  Consider the example test from the statement.
  
  In order to obtain "ba" from "ababa", you may press Backspace instead of typing the first and the fourth characters.
  
  There's no way to obtain "bb" while typing "ababa".
  
  There's no way to obtain "aaaa" while typing "aaa".
  
  In order to obtain "ababa" while typing "aababa", you have to press Backspace instead of typing the first character, then type all the remaining characters.
solution: #include <bits/stdc++.h>
  using namespace std;
  int tdong[5] = {0, 1, -1, 0, 0};
  int tcot[5] = {0, 0, 0, 1, -1};
  char direct[5] = {'A', 'U', 'D', 'L', 'R'};
  int tdm[9] = {0, -2, -2, -1, -1, 1, 1, 2, 2};
  int tcm[9] = {0, -1, 1, -2, 2, -2, 2, -1, 1};
  long long t, n, m;
  string cong(string s1, string s2) {
    if (s1 == "0" && s2 == "0") return "0";
    if (s1.length() > s2.length()) swap(s1, s2);
    s2 = "0" + s2;
    while (s1.length() != s2.length()) {
      s1 = "0" + s1;
    }
    int nho = 0, nho_1 = 0;
    for (long long i = s1.length() - 1; i >= 0; i--) {
      nho = (bool)(((int)s1[i] - 48 + (int)s2[i] - 48) + nho_1 >= 10);
      s1[i] = (char)((((int)s1[i] - 48 + (int)s2[i] - 48) + nho_1) % 10 + 48);
      nho_1 = nho;
    }
    while (s1[0] == '0') s1.erase(0, 1);
    return s1;
  }
  long long ucln(long long a, long long b) {
    while (a != b && a != 0 && b != 0) {
      if (a > b)
        a = a % b;
      else
        b = b % a;
    }
    return max(a, b);
  }
  struct fenwick_tree {
    int tree[200055];
    int mang[200055];
    void khoi_tao(int max_n) {
      for (long long i = 0; i <= max_n; i++) tree[i] = 0;
      mang[0] = 0;
    }
    void update(long long to, long long value, int max_n) {
      for (to; to < max_n + 2; to += to & (-to)) tree[to] = (tree[to] + value);
    }
    long long tinh_tong(long long to, int max_n) {
      long long kq = 0;
      if (to != 0)
        for (to; to > 0; to -= (to & (-to))) kq = (kq + tree[to]);
      return kq;
    }
    long long sum(long long from, long long to, int max_n) {
      if (from > to) swap(from, to);
      return (tinh_tong(to, max_n) - tinh_tong(from - 1, max_n));
    }
    void update_gcd(long long to, long long value, int max_n) {
      mang[to] = value;
      for (to; to <= max_n + 2; to += to & (-to))
        tree[to] = ucln(tree[to], value);
    }
    long long gcd_range(int l, int r, int max_n) {
      if (r > max_n)
        return (ucln(gcd_range(l, max_n, max_n), gcd_range(1, r - max_n, max_n)));
      if (l > r) swap(l, r);
      long long kq = 0;
      l--;
      while (r > l) {
        if ((r - r & (-r)) >= l) {
          kq = ucln(kq, tree[r]);
          r -= r & (-r);
        } else {
          kq = ucln(kq, mang[r]);
          r--;
        }
        if (kq == 1) break;
      }
      return kq;
    }
  };
  struct segment_tree {
    long long lazy[200005], s_tree[200005];
    void khoi_tao() {
      for (long long i = 1; i <= 200004; i++) {
        lazy[i] = 0;
        s_tree[i] = 0;
      }
    }
    void update_range(long long vt, long long r_left, long long r_right,
                      long long t_left, long long t_right, long long value) {
      if (lazy[vt] != 0) {
        s_tree[vt] += lazy[vt];
        lazy[vt * 2] += lazy[vt];
        lazy[vt * 2 + 1] += lazy[vt];
        lazy[vt] = 0;
      }
      if (r_left > t_right || t_left > r_right)
        return;
      else if (r_left <= t_left && r_right >= t_right) {
        s_tree[vt] += value;
        lazy[vt * 2] += value;
        lazy[vt * 2 + 1] += value;
        return;
      } else {
        long long mid = (t_left + t_right) / 2;
        update_range(vt * 2, r_left, r_right, t_left, mid, value);
        update_range(vt * 2 + 1, r_left, r_right, mid + 1, t_right, value);
        s_tree[vt] = max(s_tree[vt * 2], s_tree[vt * 2 + 1]);
      }
    }
    long long max_range(long long vt, long long r_left, long long r_right,
                        long long t_left, long long t_right) {
      if (lazy[vt] != 0) {
        s_tree[vt] += lazy[vt];
        lazy[vt * 2] += lazy[vt];
        lazy[vt * 2 + 1] += lazy[vt];
        lazy[vt] = 0;
      }
      if (r_left > t_right || r_right < t_left)
        return -99999999999999999;
      else if (r_left <= t_left && r_right >= t_right)
        return s_tree[vt];
      else {
        long long mid = (t_left + t_right) / 2;
        return max(max_range(vt * 2, r_left, r_right, t_left, mid),
                   max_range(vt * 2 + 1, r_left, r_right, mid + 1, t_right));
      }
    }
  };
  long long toi_uu_nhan(long long a, long long b, long long mod) {
    if (mod == 0) return 999999999;
    if (a == 0 || b == 0 || mod == 1) return 0;
    if (a < (mod / b + 1)) return a * b;
    a = a % mod;
    b = b % mod;
    if (a < b) swap(a, b);
    long long tam = mod / a + (bool)(mod % a != 0);
    long long mod_a = (a * tam) % mod;
    long long need = b / tam;
    long long du = b - tam * need;
    long long con_lai = du * a;
    return (toi_uu_nhan(mod_a, need, mod) + con_lai) % mod;
  }
  long long pow_f(long long a, long long b, long long k) {
    if (k == 0) return 99999999999999;
    if (k == 1) return 0;
    long long kq = 1;
    a %= k;
    while (b > 0) {
      if (b % 2 != 0) {
        kq = toi_uu_nhan(kq, a, k);
      }
      a = toi_uu_nhan(a, a, k);
      b /= 2;
    }
    return kq;
  }
  int bb[19];
  void bin(int x, int sl) {
    stack<int> s;
    int dem = 0;
    while (x > 0) {
      if (x % 2 != 0)
        s.push(1);
      else
        s.push(0);
      x /= 2;
      dem++;
    }
    while (dem < sl) {
      s.push(0);
      dem++;
    }
    while (!s.empty()) {
      cout << s.top();
      s.pop();
    }
    cout << "\n";
  }
  string intostring(long long a) {
    stack<int> st;
    while (a > 0) {
      st.push(a % 10);
      a /= 10;
    }
    string s;
    while (!st.empty()) {
      s += (char)(st.top() + '0');
      st.pop();
    }
    return s;
  }
  struct combinatoric {
    long long gt[100005], nghich_dao[100004];
    void gt_va_nghichdao() {
      gt[0] = nghich_dao[0] = 1;
      for (long long i = 1; i <= 100001; i++) {
        gt[i] = (gt[i - 1] * i) % 1000000007;
      }
      nghich_dao[100001] = pow_f(gt[100001], 1000000007 - 2, 1000000007);
      for (long long i = 100000; i >= 0; i--)
        nghich_dao[i] = (nghich_dao[i + 1] * (i + 1)) % 1000000007;
    }
    long long nck(long long n, long long k) {
      if (n < k || n < 0 || k < 0)
        return 0;
      else
        return 1LL * gt[n] * nghich_dao[n - k] % 1000000007 * nghich_dao[k] %
               1000000007;
    }
    long long nak(long long n, long long k) {
      if (n < k || n < 0 || k < 0)
        return 0;
      else
        return 1LL * gt[n] * nghich_dao[n - k] % 1000000007;
    }
  };
  stack<int> st;
  void dfs(int s, bool visit[], vector<int> v[]) {
    visit[s] = true;
    if (v[s].size() > 0)
      for (long long i = 0; i <= v[s].size() - 1; i++) {
        int j = v[s][i];
        if (!visit[j]) {
          dfs(j, visit, v);
        }
      }
    st.push(s);
  }
  void bfs(int from, int to, int step, bool visit[], int d[], int parent[]) {
    for (long long i = 0; i <= n; i++) {
      d[i] = 99999999;
      visit[i] = false;
      parent[i] = i;
    }
    d[from] = 0;
    queue<int> q;
    q.push(from);
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      if (visit[u] || u > to) continue;
      visit[u] = true;
      if (u == to) break;
      if (u == from) {
        d[u + step] = d[u] + 1;
        parent[u + step] = from;
        q.push(u + step);
      } else {
        int n0 = step + 1, n1 = -1;
        for (int i = -step; i <= step; i += 2) {
          n0--;
          n1++;
          int v = to - u;
          if (n0 > u || n1 > v) {
            continue;
          }
          if (u + i <= to && u + i >= 0)
            if (!visit[u + i] && d[u + i] > d[u] + 1) {
              d[u + i] = d[u] + 1;
              parent[u + i] = u;
              q.push(u + i);
            }
          if (u == -1) {
            cout << "* " << i << "\n";
            cout << n0 << " " << n1 << "\n";
            cout << u << " " << v << "\n";
          }
        }
      }
    }
  }
  bool comp(const pair<int, int> &g1, const pair<int, int> &g2) {
    if (g1.first != g2.first) return g1.first < g2.first;
    return g1.second > g2.second;
  }
  long long dis(long long x1, long long y1, long long x2, long long y2) {
    return (abs(x1 - x2) + abs(y1 - y2));
  }
  int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    t = 1;
    cin >> t;
    int cas = 0, cc = t;
    if (t == 0)
      while (t--) {
        cas++;
        int a[n + 5], b[n + 5];
        cin >> n;
        for (long long i = 1; i <= n; i++) {
          cin >> a[i];
        }
        for (long long i = 1; i <= n; i++) {
          cin >> b[i];
        }
        if (cas == 102) {
          cout << n << "\n";
          for (long long i = 1; i <= n; i++) cout << a[i] << " ";
          cout << "\n";
          for (long long i = 1; i <= n; i++) cout << b[i] << " ";
        }
      }
    else
      while (t--) {
        string s, ss;
        cin >> s >> ss;
        bool kt = false;
        while (ss[0] != s[0] && s.length() > 0) {
          s.erase(0, 1);
        }
        int dem = 0;
        while (!(ss.back() == s.back() && dem % 2 == 0) && s.length() > 0) {
          s.pop_back();
          dem++;
        }
        if (s.length() != 0) {
          while (!ss.empty()) {
            if (s.empty()) break;
            while (!(ss.back() == s.back() && dem % 2 == 0) && s.length() > 0) {
              dem++;
              s.pop_back();
            }
            if (s.empty()) break;
            s.pop_back();
            ss.pop_back();
            if (ss.length() == 1 && s.back() == ss.back()) {
              s.pop_back();
              ss.pop_back();
            }
          }
        }
        if (ss.empty())
          cout << "YES";
        else
          cout << "NO";
        cout << "\n";
      }
  }
  