#include <stdint.h>
#include <stdio.h>
int main() {
int t;
if (scanf("%d", &t) != EOF) {
for(int i = 0; i < t; i++) {
int a, b;
if(scanf("%d%d", &a, &b) != EOF) {
int x, y;
// printf("a:%d b:%d\n", a, b);
if(a == 0 && b == 0) {
x = 1;
y = 1;
} else if(a == 0) {
x = 2 * b;
y = b;
} else if(b == 0) {
y = 2 * a;
x = a;
} else if(a > b){
x = a;
y = a + b;
} else if(b > a){
x = a + b;
y = b;
} else if(a == b){
x = -1;
y = -1;
}
//printf("x mod y: %d\n", x % y);
//printf("y mod x: %d\n", y % x);
printf("%d %d\n", x, y);
} else printf("error1\n");
}
} else printf("error\n");
return 0;
}