#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, long *, ...);
int main() {
  long int a, b, n;
  while (scanf("%ld", &n) != EOF) {
    while (n--) {
      scanf("%ld %ld", &a, &b);
      if (b % a == 0)
        printf("%ld %ld\n", a, b);
      else
        printf("-1\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xece(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    0x2ea0(%rip),%rcx
cmp    (%rcx),%rax
je     11cc <main+0xac>
jmp    1156 <main+0x36>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x20(%rbp)
cmp    $0x0,%rax
je     11c7 <main+0xa7>
lea    0xe8a(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x18(%rbp),%rax
cqto
idivq  -0x10(%rbp)
cmp    $0x0,%rdx
jne    11b4 <main+0x94>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c2 <main+0xa2>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1156 <main+0x36>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebf(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x2e92(%rip),%r15
cmp    (%r15),%rax
je     1200 <main+0xd0>
lea    0xe9a(%rip),%r12
lea    0x10(%rsp),%r13
lea    0x8(%rsp),%rbx
lea    0xe91(%rip),%rbp
lea    0xe93(%rip),%r14
jmp    1188 <main+0x58>
mov    %r14,%rdi
call   1030 <puts@plt>
subq   $0x1,(%rsp)
jb     11ea <main+0xba>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x8(%rsp),%rcx
mov    0x10(%rsp),%rsi
mov    %rcx,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     11d0 <main+0xa0>
mov    %rcx,%rax
cqto
idiv   %rsi
test   %rdx,%rdx
jne    1180 <main+0x50>
jmp    11db <main+0xab>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ecx,%eax
xor    %edx,%edx
div    %esi
test   %rdx,%rdx
jne    1180 <main+0x50>
mov    %rbp,%rdi
mov    %rcx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1188 <main+0x58>
lea    0xe13(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    (%r15),%rax
jne    1188 <main+0x58>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%ld\00"
@EOF = global i64 0
@.str.1 = [8 x i8] c"%ld %ld\00"
@.str.2 = [9 x i8] c"%ld %ld\0A\00"
@.str.3 = [4 x i8] c"-1\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i32 0, i32* %1
br label %5
5: ; preds = %27, %0
%6 = call i64 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %4)
%7 = load i64, i64* @EOF
%8 = icmp ne i64 %6, %7
br i1 %8, label %9, label %28
9: ; preds = %5
br label %10
10: ; preds = %26, %9
%11 = load i64, i64* %4
%12 = add nsw i64 %11, -1
store i64 %12, i64* %4
%13 = icmp ne i64 %11, 0
br i1 %13, label %14, label %27
14: ; preds = %10
%15 = call i64 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i64* %2, i64* %3)
%16 = load i64, i64* %3
%17 = load i64, i64* %2
%18 = srem i64 %16, %17
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %14
%21 = load i64, i64* %2
%22 = load i64, i64* %3
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 %21, i64 %22)
br label %26
24: ; preds = %14
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %24, %20
br label %10
27: ; preds = %10
br label %5
28: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
@EOF = global i64 0
@.str.1 = [8 x i8] c"%ld %ld\00"
@.str.2 = [9 x i8] c"%ld %ld\0A\00"
@str = [3 x i8] c"-1\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = bitcast i64* %1 to i8*
%5 = bitcast i64* %2 to i8*
%6 = bitcast i64* %3 to i8*
%7 = call i64 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %3)
%8 = load i64, i64* @EOF
%9 = icmp eq i64 %7, %8
br i1 %9, label %32, label %14
10: ; preds = %28, %14
%11 = call i64 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %3)
%12 = load i64, i64* @EOF
%13 = icmp eq i64 %11, %12
br i1 %13, label %32, label %14
14: ; preds = %0, %10
%15 = load i64, i64* %3
%16 = add nsw i64 %15, -1
store i64 %16, i64* %3
%17 = icmp eq i64 %15, 0
br i1 %17, label %10, label %18
18: ; preds = %14, %28
%19 = call i64 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i64* %1, i64* %2)
%20 = load i64, i64* %2
%21 = load i64, i64* %1
%22 = srem i64 %20, %21
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %18
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 %21, i64 %20)
br label %28
26: ; preds = %18
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
br label %28
28: ; preds = %26, %24
%29 = load i64, i64* %3
%30 = add nsw i64 %29, -1
store i64 %30, i64* %3
%31 = icmp eq i64 %29, 0
br i1 %31, label %10, label %18
32: ; preds = %10, %0
ret i32 0
}