1164: [CSP-J 2022] 解密

文件提交:无需freopen 内存限制:128 MB 时间限制:1.000 S
评测方式:普通裁判 命题人:
提交:1 解决:1

题目描述

给定一个正整数 lns="http://www.w3.org/1998/Math/MathML">,有 lns="http://www.w3.org/1998/Math/MathML"> 次询问,每次给定三个正整数 lns="http://www.w3.org/1998/Math/MathML">,,,求两个正整数 lns="http://www.w3.org/1998/Math/MathML">,,使 lns="http://www.w3.org/1998/Math/MathML">=×lns="http://www.w3.org/1998/Math/MathML">×=(1)(1)+1

输入

第一行一个正整数 lns="http://www.w3.org/1998/Math/MathML">,表示有 lns="http://www.w3.org/1998/Math/MathML"> 次询问。

接下来 lns="http://www.w3.org/1998/Math/MathML"> 行,第 lns="http://www.w3.org/1998/Math/MathML"> 行三个正整数 lns="http://www.w3.org/1998/Math/MathML">,,

输出

输出 lns="http://www.w3.org/1998/Math/MathML"> 行,每行两个正整数 lns="http://www.w3.org/1998/Math/MathML">, 表示答案。

为使输出统一,你应当保证 lns="http://www.w3.org/1998/Math/MathML">

如果无解,请输出 NO

样例输入

10
770 77 5
633 1 211
545 1 499
683 3 227
858 3 257
723 37 13
572 26 11
867 17 17
829 3 263
528 4 109

样例输出

2 385
NO
NO
NO
11 78
3 241
2 286
NO
NO
6 88

来源/分类