Big Integers

시간 제한2초메모리 제한2048 MB

요약
서로 다른 두 개의 62진수 문자열이 주어질 때, 사전순으로 더 작은 문자열이 나타내는 정수가 실제로도 더 작은지 판정한다.
난이도

보통10점 중 4점

유형
문자열, 수학, 구현, 정렬
정답자
아직 제출이 없습니다

문제

Nick is preparing a problem for a programming contest about comparing big integers. He has decided on the input format for the integers: They will be expressed in base 62, with 00 through 99 representing digit values 00 through 99, lowercase letters a through z representing digit values 1010 through 3535, and uppercase letters A through Z representing digit values 3636 through 6161. For example, the string Aa would represent 36×62+10=224236 \times 62 + 10 = 2242.

The problem is to take two strings representing two distinct base 62 integers and determine which of the two is smaller. However, Nick wrote his judge solution incorrectly, assuming that the lexicographically smaller string is always the smaller integer.

Given some test cases, determine for each if Nick's solution would report the correct result.

입력

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

Each test case consists of two lines.

The first line contains a single alphanumeric string of length at most 10510^5.

The second line contains a single alphanumeric string of length at most 10510^5.

Both strings are guaranteed to contain no unnecessary leading zeroes, and the two strings are guaranteed to be distinct.

The sum of the lengths of all input strings across all tt test cases is guaranteed to be at most 2×1062 \times 10^6.

출력

For each test case, output a single line with YES if the lexicographically smaller string represents the smaller integer in base 62, and output a single line with NO otherwise.

예제1

  1. 예제 1

    입력
    2
    icpc
    ICPC
    a
    bc
    
    예상 출력
    NO
    YES