Universal Cup Judging System

Universal Cup

시간 제한: 3 s 메모리 제한: 1024 MB 총점: 100 해킹 가능 ✓
통계

양의 정수 $X$와 $b\ge 2$에 대해, $f(X,b)$를 $X$의 $b$진법 표현을 나타내는 수열로 정의합니다. 이 수열의 $i$번째 원소는 $X$의 $b$진법 표현에서 가장 낮은 자리부터 세어 $i$번째 자리의 숫자입니다. 예를 들어 $f(6,2)=\{0,1,1\}$이고, $f(233,17)=\{12,13\}$입니다.

양의 정수 $x$, $y$, $A$, $B$가 주어집니다. 다음 조건을 만족하는 두 양의 정수 $a$와 $b$를 찾으세요.

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

입력

여러 테스트 케이스가 주어집니다. 입력의 첫째 줄에는 테스트 케이스의 수를 나타내는 정수 $T$ ($1\le T\le 10^3$)가 주어집니다. 각 테스트 케이스에 대해:

첫째 줄에는 네 정수 $x$, $y$, $A$, $B$가 주어집니다 ($1\le x,y\le 10^9$, $2\le A,B\le 10^9$).

$\max(x,y)>10^6$을 만족하는 테스트 케이스는 최대 $50$개임이 보장됩니다.

출력

각 테스트 케이스에 대해, 조건을 만족하는 양의 정수 $a$와 $b$가 존재하지 않으면 한 줄에 NO를 출력하세요.

그렇지 않으면 먼저 한 줄에 YES를 출력하세요. 다음 줄에는 두 정수 $a$와 $b$를 공백으로 구분하여 출력하세요. 가능한 답이 여러 개이면 아무거나 출력해도 됩니다.

예제

입력 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

출력 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.