CF BUDDY
← Problems·

1984B · Large Addition

1100 · implementation, math

Problem: A digit is large if it is between 55 and 99, inclusive. A positive integer is large if all of its digits are large.

You are given an integer xx. Can it be the sum of two large positive integers with the same number of digits?

Input Format: The first line contains a single integer tt (1t1041 \leq t \leq 10^4) — the number of test cases.

The only line of each test case contains a single integer xx (10x101810 \leq x \leq 10^{18}).

Output Format: For each test case, output YES\texttt{YES} if xx satisfies the condition, and NO\texttt{NO} otherwise.

You can output YES\texttt{YES} and NO\texttt{NO} in any case (for example, strings yES\texttt{yES}, yes\texttt{yes}, and Yes\texttt{Yes} will be recognized as a positive response).

Note: In the first test case, we can have 658+679=1337658 + 679 = 1337.

In the second test case, it can be shown that no numbers of equal length and only consisting of large digits can add to 200200.

In the third test case, we can have 696969+696969=1393938696\,969 + 696\,969 = 1\,393\,938.

In the fourth test case, we can have 777+657=1434777 + 657 = 1434.

Sample Cases

Case 1

Input

11
1337
200
1393938
1434
98765432123456789
11111111111111111
420
1984
10
69
119

Output

YES
NO
YES
YES
NO
YES
NO
YES
YES
NO
NO

Similar problems

00:00:00
Loading editor…
Welcome! I'm your coding tutor for this problem. Use the chips below to reveal stored hints or get AI feedback on your code. I'll guide you step by step — never giving away the solution.

Sign in to unlock AI tutor feedback