Codeforces Round 1004 (Div. 2)
A
Adjacent Digit Sums
Codeforces
800
原题
←B →
翻译中…

You are given two numbers $x, y$. You need to determine if there exists an integer $n$ such that $S(n) = x$, $S(n + 1) = y$.

翻译中…

Here, $S(a)$ denotes the sum of the digits of the number $a$ in the decimal numeral system.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 500$). The description of the test cases follows.

翻译中…

The first line of each test case contains two integers $x, y$ ($1 \le x \le 1000, 1 \le y \le 1000$).

翻译中…

Output

翻译中…

For each test case, print "NO" if a suitable $n$ does not exist. Otherwise, output "YES".

翻译中…

You can output each letter in any case (for example, "YES", "Yes", "yes", "yEs", "yEs" will be recognized as a positive answer).

翻译中…

Note

翻译中…

In the first test case, for example, $n = 100$ works. $S(100) = 1$, $S(101) = 2$.

翻译中…

In the second test case, it can be shown that $S(n) \neq S(n+1)$ for all $n$; therefore, the answer is No.

翻译中…

In the fourth test case, $n = 10^{111}-1$ works, which is a number consisting of $111$ digits of $9$.

翻译中…

样例

Input #1
7
1 2
77 77
997 999
999 1
1000 1
1 11
18 1
Output #1
Yes
No
No
Yes
No
No
Yes
InputCopy OutputCopy
题目信息
题号
2067A
时间限制
1 s
内存限制
256 MB
标签
暴力
构造
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。