B - LCM Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MiB

配点 : 600

問題文

正整数 A_1,A_2,A_3 が与えられます。

以下の条件を全て満たす正整数の組 (X_1,X_2) が存在するか判定し、存在する場合は一組求めてください。

  • X_1 は十進法で A_1 桁の整数である。
  • X_2 は十進法で A_2 桁の整数である。
  • X_1X_2 の最小公倍数は十進法で A_3 桁の整数である。

T 個のテストケースが与えられるので、それぞれについて答えを求めてください。

制約

  • 1\le T\le 17^3
  • 1\le A_1,A_2,A_3\le 17
  • 入力される値は全て整数

入力

入力は以下の形式で標準入力から与えられる。

T
\text{case}_1
\text{case}_2
\vdots
\text{case}_T

各テストケースは以下の形式で与えられる。

A_1 A_2 A_3

出力

各テストケースに対する答えを順に改行区切りで出力せよ。

各テストケースについて、条件を全て満たす (X_1,X_2) が存在しない場合は No と出力せよ。

そうでない場合、条件を全て満たす (X_1,X_2) を以下の形式で出力せよ。

Yes
X_1 X_2

条件を満たす (X_1,X_2) が複数ある場合、どれを出力しても正答となる。


入力例 1

3
4 3 5
1 1 7
8 6 11

出力例 1

Yes
2025 200
No
Yes
20250615 200200

1 つ目のテストケースについて、 (X_1,X_2)=(2025,200) とすると X_1,X_2 の最小公倍数は 16200 となり条件を満たすことが分かります。その他にも (X_1,X_2)=(2025,125),(7777,231) などが条件を満たします。

Score : 600 points

Problem Statement

You are given positive integers A_1,A_2,A_3.

Determine whether there exists a pair of positive integers (X_1,X_2) that satisfies all the following conditions, and if it exists, find one.

  • X_1 is an integer with A_1 digits in decimal notation.
  • X_2 is an integer with A_2 digits in decimal notation.
  • The least common multiple of X_1 and X_2 is an integer with A_3 digits in decimal notation.

You are given T test cases, so find the answer for each.

Constraints

  • 1\le T\le 17^3
  • 1\le A_1,A_2,A_3\le 17
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

T
\text{case}_1
\text{case}_2
\vdots
\text{case}_T

Each test case is given in the following format:

A_1 A_2 A_3

Output

Output your solutions for the test cases in order, separated by newlines.

For each test case, if there is no (X_1,X_2) that satisfies all conditions, output No.

Otherwise, output a (X_1,X_2) that satisfies all conditions in the following format:

Yes
X_1 X_2

If there are multiple (X_1,X_2) that satisfy the conditions, you may output any of them.


Sample Input 1

3
4 3 5
1 1 7
8 6 11

Sample Output 1

Yes
2025 200
No
Yes
20250615 200200

For the first test case, if we set (X_1,X_2)=(2025,200), then the least common multiple of X_1,X_2 is 16200, which satisfies the conditions. Other examples that satisfy the conditions include (X_1,X_2)=(2025,125),(7777,231).