| t | def main(): | t | def main(): | 
             |     text = input() |  |     text = input() | 
             |     pattern = input() |  |     pattern = input() | 
             |     (text_len, pat_len) = (len(text), len(pattern)) |  |     (text_len, pat_len) = (len(text), len(pattern)) | 
             |     if pat_len > text_len: |  |     if pat_len > text_len: | 
             |         print('NO') |  |         print('NO') | 
             |         return |  |         return | 
             |     if pat_len == 0: |  |     if pat_len == 0: | 
             |         print('YES') |  |         print('YES') | 
             |         return |  |         return | 
             |     (i, j, step, cur_begin) = (0, 0, 0, 0) |  |     (i, j, step, cur_begin) = (0, 0, 0, 0) | 
             |     flag = False |  |     flag = False | 
             |     while i < text_len: |  |     while i < text_len: | 
             |         while i < text_len and text[i] != pattern[j]: |  |         while i < text_len and text[i] != pattern[j]: | 
             |             i += 1 |  |             i += 1 | 
             |         if i >= text_len: |  |         if i >= text_len: | 
             |             print('NO') |  |             print('NO') | 
             |             return |  |             return | 
             |         else: |  |         else: | 
             |             cur_begin = i |  |             cur_begin = i | 
             |             j += 1 |  |             j += 1 | 
             |             if j >= pat_len: |  |             if j >= pat_len: | 
             |                 print('YES') |  |                 print('YES') | 
             |                 return |  |                 return | 
             |             while i < text_len and text[i] != pattern[j]: |  |             while i < text_len and text[i] != pattern[j]: | 
             |                 i += 1 |  |                 i += 1 | 
             |                 step += 1 |  |                 step += 1 | 
             |             if i >= text_len: |  |             if i >= text_len: | 
             |                 print('NO') |  |                 print('NO') | 
             |                 return |  |                 return | 
             |             else: |  |             else: | 
             |                 while i < text_len and j < pat_len and (text[i] == pattern[j]): |  |                 while i < text_len and j < pat_len and (text[i] == pattern[j]): | 
             |                     j += 1 |  |                     j += 1 | 
             |                     i += step |  |                     i += step | 
             |                 if j == pat_len: |  |                 if j == pat_len: | 
             |                     print('YES') |  |                     print('YES') | 
             |                     return |  |                     return | 
             |                 else: |  |                 else: | 
             |                     i = cur_begin + 1 |  |                     i = cur_begin + 1 | 
             |                     step = 0 |  |                     step = 0 | 
             |                     j = 0 |  |                     j = 0 | 
             |     print('NO') |  |     print('NO') | 
             | if __name__ == '__main__': |  | if __name__ == '__main__': | 
             |     main() |  |     main() |