#include <bits/stdc++.h>
using namespace std;
int main() {
freopen("decode.in", "r", stdin);
freopen("decode.out", "w", stdout);
long long n, i, j, k;
cin >> n;
for (int i = 1; i <= n; i++) {
long long cut = 0;
long long a, b, c;
cin >> a >> b >> c;
for (j = 1; j <= a; j++) {
for (k = 1; k <= a; k++) {
if (a == k * j && b * c == (j - 1) * (k - 1) + 1 && j <= k) {
cout << j << " " << k << endl;
break;
} else {
cut++;
}
}
}
if (cut == a * a) {
cout << "NO" << endl;
}
}
}