Under construction

Still being built. Things may change

Big Integers

Interview

Time limit2sMemory limit2048 MB

Summary
For each pair of base 62 strings, check whether lexicographic order matches numeric order and print YES or NO.
Level

Easy3 of 10

Topics
String, Implementation
Solved
No attempts yet

Problem

Nick is preparing a problem for a programming contest about comparing big integers. Integers are written in base 62, with the digits 0 through 9 representing values 0 through 9, the lowercase letters a through z representing values 10 through 35, and the uppercase letters A through Z representing values 36 through 61. For example, Aa represents 36×62+10=224236 \times 62 + 10 = 2242.

The problem takes two strings that represent two distinct base 62 integers and asks which integer is smaller. Nick assumed that the string that comes first in lexicographic order is always the smaller integer, and he wrote his judge solution with that assumption.

For each test case, determine whether Nick's solution reports the correct result.

Input

The first line contains a single integer tt (1≤t≤1051 \leq t \leq 10^5), the number of test cases.

Each test case consists of two lines. The first line contains an alphanumeric string of length at most 10510^5. The second line contains an alphanumeric string of length at most 10510^5.

Both strings have no unnecessary leading zeroes, and the two strings in a test case are distinct. The sum of the lengths of all input strings across all test cases is at most 2×1062 \times 10^6.

Output

For each test case, print YES if the lexicographically smaller string represents the smaller integer in base 62. Otherwise, print NO.

Examples1

  1. Example 1

    Input
    2
    icpc
    ICPC
    a
    bc
    
    Expected output
    NO
    YES