{"problem":{"name":"[GDCPC 2023] X Equals Y","description":{"content":"For positive integers $X$ and $b \\geq 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 dig","description_type":"Markdown"},"platform":"Luogu","limit":{"time_limit":3000,"memory_limit":1048576},"difficulty":{"LuoguStyle":"P5"},"is_remote":true,"is_sync":true,"sync_url":null,"sign":"LGP9699"},"statements":[{"statement_type":"Markdown","content":"For positive integers $X$ and $b \\geq 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\\}$.\n\nGiven four positive integers $x$, $y$, $A$ and $B$, please find two positive integers $a$ and $b$ satisfying:\n\n- $2 \\leq a \\leq A$\n- $2 \\leq b \\leq B$\n- $f(x, a) = f(y, b)$\n\n## Input\n\nThere are multiple test cases. The first line of the input contains an integer $T$ ($1 \\leq T \\leq 10^3$) indicating the number of test cases. For each test case:\n\nThe first line contains four integers $x$, $y$, $A$ and $B$ ($1 \\leq x,y \\leq 10^9$, $2 \\leq A,B \\leq 10^9$).\n\nIt's guaranteed that there are at most $50$ test cases satisfying $\\max(x, y) > 10^6$.\n\n## Output\n\nFor each test case, if valid positive integers $a$ and $b$ do not exist, output $\\texttt{NO}$ in one line.\n\nOtherwise, first output $\\texttt{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.\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"LGP9699","tags":["数学","2023","广东","Special Judge","O2优化","进制","省赛/邀请赛"],"sample_group":[["6\n1 1 1000 1000\n1 2 1000 1000\n3 11 1000 1000\n157 291 5 6\n157 291 3 6\n10126 114514 789 12345","YES\n2 2\nNO\nYES\n2 10\nYES\n4 5\nNO\nYES\n779 9478"]],"created_at":"2026-03-03 11:09:25"}}