#include #include int main() { int Tests; scanf("%d", &Tests); while (Tests--) { int a, b; scanf("%d%d", &a, &b); int x = std::abs(a - b); if (x == 0) { if (a == 1) puts("-1 -1"); else printf("%d %d\n", 2, a); } else if (x == 1) puts("-1 -1"); else { int p = x; for (int y = 2; y * y <= x; ++y) if (x % y == 0) { p = y; break; } printf("%d %d\n", p, x); } } return 0; }