#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
while (b != 0) {
ll temp = b;
b = a % b;
a = temp;
}
return a;
}
int main() {
int t;
cin >> t;
while(t--){
ll l, r, k;
bool b = false;
cin >> l >> r >> k;
l = (l + k - 1) / k;
r = r / k;
if(r - l < 0 || r - l == 0 && r != 1){
cout << "-1 -1\n";
}
else{
for(ll i = r - l; i >= 0; i--){
for(ll j = 0; l + j + i <= r; j++){
if(gcd(l + j, l + j + i) == 1){
cout << (l + j) * k << " " << (l + j + i) * k << endl;
b = true;
break;
}
}
if(b)break;
}
}
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8bWFwPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8c2V0Pgp1c2luZyBuYW1lc3BhY2Ugc3RkOwp0eXBlZGVmIGxvbmcgbG9uZyBsbDsKCmxsIGdjZChsbCBhLCBsbCBiKSB7CiAgICB3aGlsZSAoYiAhPSAwKSB7CiAgICAgICAgbGwgdGVtcCA9IGI7CiAgICAgICAgYiA9IGEgJSBiOwogICAgICAgIGEgPSB0ZW1wOwogICAgfQogICAgcmV0dXJuIGE7Cn0KCmludCBtYWluKCkgewogICAgaW50IHQ7CiAgICBjaW4gPj4gdDsKICAgIHdoaWxlKHQtLSl7CiAgICAgICAgbGwgbCwgciwgazsKICAgICAgICBib29sIGIgPSBmYWxzZTsKICAgICAgICBjaW4gPj4gbCA+PiByID4+IGs7CiAgICAgICAgbCA9IChsICsgayAtIDEpIC8gazsKICAgICAgICByID0gciAvIGs7CiAgICAgICAgCiAgICAgICAgaWYociAtIGwgPCAwIHx8IHIgLSBsID09IDAgJiYgciAhPSAxKXsKICAgICAgICAgICAgY291dCA8PCAiLTEgLTFcbiI7CiAgICAgICAgfQogICAgICAgIGVsc2V7CiAgICAgICAgICAgIGZvcihsbCBpID0gciAtIGw7IGkgPj0gMDsgaS0tKXsKICAgICAgICAgICAgICAgIGZvcihsbCBqID0gMDsgbCArIGogKyBpIDw9IHI7IGorKyl7CiAgICAgICAgICAgICAgICAgICAgaWYoZ2NkKGwgKyBqLCBsICsgaiArIGkpID09IDEpewogICAgICAgICAgICAgICAgICAgICAgICBjb3V0IDw8IChsICsgaikgKiBrIDw8ICIgIiA8PCAobCArIGogKyBpKSAqIGsgPDwgZW5kbDsKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmKGIpYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9Cn0=