Universal Cup Judging System

Universal Cup

حد الوقت: 3 s حد الذاكرة: 1024 MB مجموع النقاط: 100 قابلة للهجوم ✓
الإحصائيات

For positive integers $X$ and $b\ge 2$, define $f(X,b)$ as a sequence which describes the base-$b$ representation of $X$, where the $i$-th element in the sequence is the $i$-th least significant digit in the base-$b$ representation of $X$. For example, $f(6,2)=\{0,1,1\}$, while $f(233,17)=\{12,13\}$.

Given four positive integers $x$, $y$, $A$ and $B$, please find two positive integers $a$ and $b$ satisfying:

  • $2\le a\le A$
  • $2\le b\le B$
  • $f(x,a)=f(y,b)$

Input

There are multiple test cases. The first line of the input contains an integer $T$ ($1\le T\le 10^3$) indicating the number of test cases. For each test case:

The first line contains four integers $x$, $y$, $A$ and $B$ ($1\le x,y\le 10^9$, $2\le A,B\le 10^9$).

It's guaranteed that there are at most $50$ test cases satisfying $\max(x,y)>10^6$.

Output

For each test case, if valid positive integers $a$ and $b$ do not exist, output NO in one line.

Otherwise, first output YES in one line. Then in the next line, output two integers $a$ and $b$ separated by a space. If there are multiple valid answers, you can output any of them.

Examples

Input 1

6
1 1 1000 1000
1 2 1000 1000
3 11 1000 1000
157 291 5 6
157 291 3 6
10126 114514 789 12345

Output 1

YES
2 2
NO
YES
2 10
YES
4 5
NO
YES
779 9478

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.