#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 */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int s, d, i, j, n, big, small, difference;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d %d", &big, &small);
    {
      if (small > big) {
        printf("impossible\n");
      } else if (big == 0 && small % 2 == 1) {
        printf("impossible\n");
      } else if (big == 0 && small % 2 == 0) {
        printf("impossible\n");
      } else if (small == 0) {
        printf("impossible\n");
      } else if (big > small) {
        difference = big - small;
        s = difference / 2 + small;
        d = s - small;
        if (difference % 2 == 1) {
          printf("impossible\n");
        } else {
          printf("%d %d\n", s, d);
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecd(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     129e <main+0x17e>
lea    0xea5(%rip),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    1189 <main+0x69>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    128b <main+0x16b>
cmpl   $0x0,-0x1c(%rbp)
jne    11ba <main+0x9a>
mov    -0x20(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    11ba <main+0x9a>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1286 <main+0x166>
cmpl   $0x0,-0x1c(%rbp)
jne    11eb <main+0xcb>
mov    -0x20(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11eb <main+0xcb>
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1281 <main+0x161>
cmpl   $0x0,-0x20(%rbp)
jne    1208 <main+0xe8>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    127c <main+0x15c>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    1277 <main+0x157>
mov    -0x1c(%rbp),%eax
sub    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    -0x20(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x20(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    125e <main+0x13e>
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1272 <main+0x152>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1277 <main+0x157>
jmp    127c <main+0x15c>
jmp    1281 <main+0x161>
jmp    1286 <main+0x166>
jmp    128b <main+0x16b>
jmp    1290 <main+0x170>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1148 <main+0x28>
xor    %eax,%eax
add    $0x30,%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    0xebe(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11fb <main+0xcb>
lea    0xe9d(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%rbx
lea    0xe99(%rip),%r12
lea    0xe8b(%rip),%r13
xor    %ebp,%ebp
jmp    1191 <main+0x61>
nop
mov    %r12,%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    11fb <main+0xcb>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x10(%rsp),%esi
mov    0x14(%rsp),%eax
cmp    %esi,%eax
jl     1180 <main+0x50>
test   %eax,%eax
jne    11c4 <main+0x94>
mov    %esi,%ecx
shr    $0x1f,%ecx
add    %esi,%ecx
and    $0xfffffffe,%ecx
mov    %esi,%edx
sub    %ecx,%edx
cmp    $0x1,%edx
je     1180 <main+0x50>
test   %eax,%eax
je     11ce <main+0x9e>
test   %esi,%esi
jne    11d4 <main+0xa4>
jmp    1180 <main+0x50>
test   $0x1,%sil
je     1180 <main+0x50>
sub    %esi,%eax
jle    1188 <main+0x58>
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
mov    %edx,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%eax
cmp    $0x1,%eax
je     1180 <main+0x50>
sar    %edx
add    %edx,%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    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 = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [12 x i8] c"impossible\0A\00"
@.str.3 = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
store i32 1, i32* %4
br label %11
11: ; preds = %75, %0
%12 = load i32, i32* %4
%13 = load i32, i32* %6
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %78
15: ; preds = %11
%16 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %7, i32* %8)
%17 = load i32, i32* %8
%18 = load i32, i32* %7
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %74
22: ; preds = %15
%23 = load i32, i32* %7
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %31
25: ; preds = %22
%26 = load i32, i32* %8
%27 = srem i32 %26, 2
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %73
31: ; preds = %25, %22
%32 = load i32, i32* %7
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %40
34: ; preds = %31
%35 = load i32, i32* %8
%36 = srem i32 %35, 2
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %72
40: ; preds = %34, %31
%41 = load i32, i32* %8
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %71
45: ; preds = %40
%46 = load i32, i32* %7
%47 = load i32, i32* %8
%48 = icmp sgt i32 %46, %47
br i1 %48, label %49, label %70
49: ; preds = %45
%50 = load i32, i32* %7
%51 = load i32, i32* %8
%52 = sub nsw i32 %50, %51
store i32 %52, i32* %9
%53 = load i32, i32* %9
%54 = sdiv i32 %53, 2
%55 = load i32, i32* %8
%56 = add nsw i32 %54, %55
store i32 %56, i32* %2
%57 = load i32, i32* %2
%58 = load i32, i32* %8
%59 = sub nsw i32 %57, %58
store i32 %59, i32* %3
%60 = load i32, i32* %9
%61 = srem i32 %60, 2
%62 = icmp eq i32 %61, 1
br i1 %62, label %63, label %65
63: ; preds = %49
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %69
65: ; preds = %49
%66 = load i32, i32* %2
%67 = load i32, i32* %3
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %66, i32 %67)
br label %69
69: ; preds = %65, %63
br label %70
70: ; preds = %69, %45
br label %71
71: ; preds = %70, %43
br label %72
72: ; preds = %71, %38
br label %73
73: ; preds = %72, %29
br label %74
74: ; preds = %73, %20
br label %75
75: ; preds = %74
%76 = load i32, i32* %4
%77 = add nsw i32 %76, 1
store i32 %77, i32* %4
br label %11
78: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.3 = [7 x i8] c"%d %d\0A\00"
@str.7 = [11 x i8] c"impossible\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 1
br i1 %9, label %51, label %10
10: ; preds = %0, %47
%11 = phi i32 [ %48, %47 ], [ 1, %0 ]
%12 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, %13
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.7, i64 0, i64 0))
br label %47
18: ; preds = %10
%19 = icmp eq i32 %14, 0
%20 = srem i32 %13, 2
%21 = icmp eq i32 %20, 1
%22 = select i1 %19, i1 %21, i1 false
br i1 %22, label %23, label %25
23: ; preds = %18
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.7, i64 0, i64 0))
br label %47
25: ; preds = %18
br i1 %19, label %26, label %31
26: ; preds = %25
%27 = and i32 %13, 1
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %35
29: ; preds = %26
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.7, i64 0, i64 0))
br label %47
31: ; preds = %25
%32 = icmp eq i32 %13, 0
br i1 %32, label %33, label %35
33: ; preds = %31
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.7, i64 0, i64 0))
br label %47
35: ; preds = %26, %31
%36 = icmp sgt i32 %14, %13
br i1 %36, label %37, label %47
37: ; preds = %35
%38 = sub nsw i32 %14, %13
%39 = sdiv i32 %38, 2
%40 = srem i32 %38, 2
%41 = icmp eq i32 %40, 1
br i1 %41, label %42, label %44
42: ; preds = %37
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.7, i64 0, i64 0))
br label %47
44: ; preds = %37
%45 = add nsw i32 %39, %13
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %45, i32 %39)
br label %47
47: ; preds = %16, %29, %35, %44, %42, %33, %23
%48 = add nuw nsw i32 %11, 1
%49 = load i32, i32* %1
%50 = icmp slt i32 %11, %49
br i1 %50, label %10, label %51
51: ; preds = %47, %0
ret i32 0
}