#P9699. [GDCPC 2023] X Equals Y
[GDCPC 2023] X Equals Y
题目描述
For positive integers and , define as a sequence which describes the base- representation of , where the -th element in the sequence is the -th least significant digit in the base- representation of . For example, , while .
Given four positive integers , , and , please find two positive integers and satisfying:
输入格式
There are multiple test cases. The first line of the input contains an integer () indicating the number of test cases. For each test case:
The first line contains four integers , , and (, ).
It's guaranteed that there are at most test cases satisfying .
输出格式
For each test case, if valid positive integers and do not exist, output in one line.
Otherwise, first output in one line. Then in the next line, output two integers and separated by a space. If there are multiple valid answers, you can output any of them.
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
YES
2 2
NO
YES
2 10
YES
4 5
NO
YES
779 9478