P20377 [CodeChef] CRDGAME3
普及-
题目描述

Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.

Chef is playing a card game with his friend Rick Sanchez. He recently won against Rick's grandson Morty; however, Rick is not as easy to beat. The rules of this game are as follows:
The power of a positive integer is the sum of digits of that integer. For example, the power of $13$ is $1+3 = 4$.
Chef and Rick receive randomly generated positive integers. For each player, let's call the integer he received final power.
The goal of each player is to generate a positive integer such that its power (defined above) is equal to his final power.
The player who generated the integer with fewer digits wins the game. If both have the same number of digits, then Rick cheats and wins the game.

You are given the final power of Chef $P_{C}$ and the final power of Rick $P_{R}$. Assuming that both players play optimally, find the winner of the game and the number of digits of the integer he generates.

------ Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first and only line of each test case contains two space-separated integers $P_{C}$ and $P_{R}$.

------ Output ------
For each test case, print a single line containing two space-separated integers. The first of these integers should be either $0$ if Chef wins or $1$ if Rick wins. The second integer should be the number of digits of the integer generated by the winner.

------ Constraints ------
$1 ≤ T ≤ 10^{5}$
$1 ≤ P_{C}, P_{R} ≤ 10^{6}$

------ Subtasks ------
Subtask #1 (100 points): original constraints

----- Sample Input 1 ------
3

3 5

28 18

14 24
----- Sample Output 1 ------
1 1

1 2

0 2
----- explanation 1 ------
Example case 1: Chef and Rick generate the optimal integers $3$ and $5$ respectively. Each of them has $1$ digit, so Rick cheats and wins the game.

Example case 2: Chef and Rick could generate e.g. $6877$ and $99$ respectively. Since Rick's integer has $2$ digits and Chef cannot generate an integer with less than $4$ digits, Rick wins.

Example case 3: Chef and Rick could generate e.g. $86$ and $888$ respectively. Chef's integer has $2$ digits and Rick cannot generate an integer with less than $3$ digits, so Chef wins.

输入格式

见题面

输出格式

见题面

样例输入
3 3 5 28 18 14 24
样例输出
1 1 1 2 0 2