Consider a search engine that knows a number of sites. A site is described by a well-formed domain name which consists of two or more domain parts separated by dots such as www.sharif.edu. A domain part is a string of upper-case and lower-case alphabetic characters. For the rest of this description, we use the term domain name for well-formed domain name.
To restrict a search to some specific sites, a user is allowed to use domain patterns in a search query. A domain pattern is similar to a domain name, except that it may contain arbitrary number of the following wildcards:
The first line of the input file contains a single integer t (1 <= t <= 10), the number of test cases, followed by the input data for each test case. Each test case consists of two lines, each containing a domain pattern. Each domain pattern is at most 255 characters long, and does not include any leading or trailing blank characters.
There should be one line per test case in the output file containing a single word YES or NO, depending on whether the two domain patterns in the test case match or not.
2 www.?.edu ?.edu *.edu yahoo.com
YES NO