#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 *, long long *, ...);
int main() {
  long long int sum, absDiff, larger, smaller, numCase;
  int flagPossible;
  scanf("%lld", &numCase);
  while (numCase) {
    flagPossible = 1;
    scanf("%lld %lld", &sum, &absDiff);
    if (sum < absDiff)
      flagPossible = 0;
    else {
      larger = sum + absDiff;
      if (larger & 1 == 1) {
        flagPossible = 0;
      } else {
        larger >>= 1;
        smaller = larger - absDiff;
      }
    }
    if (flagPossible)
      printf("%lld %lld\n", larger, smaller);
    else
      printf("impossible\n");
    numCase--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecf(%rip),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpq   $0x0,-0x30(%rbp)
je     120e <main+0xee>
movl   $0x1,-0x34(%rbp)
lea    0xea6(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    1183 <main+0x63>
movl   $0x0,-0x34(%rbp)
jmp    11ca <main+0xaa>
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     11ad <main+0x8d>
movl   $0x0,-0x34(%rbp)
jmp    11c5 <main+0xa5>
mov    -0x20(%rbp),%rax
sar    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
sub    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    11ca <main+0xaa>
cmpl   $0x0,-0x34(%rbp)
je     11ef <main+0xcf>
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11fd <main+0xdd>
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
jmp    1141 <main+0x21>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0xec1(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpq   $0x0,0x8(%rsp)
je     11d3 <main+0xa3>
lea    0xea1(%rip),%r14
lea    0x18(%rsp),%r15
lea    0x10(%rsp),%rbx
lea    0xea5(%rip),%r12
lea    0xe93(%rip),%r13
jmp    1190 <main+0x60>
nopl   0x0(%rax)
mov    %r12,%rdi
call   1030 <puts@plt>
addq   $0xffffffffffffffff,0x8(%rsp)
je     11d3 <main+0xa3>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x18(%rsp),%rsi
mov    0x10(%rsp),%rax
cmp    %rax,%rsi
jl     1180 <main+0x50>
add    %rax,%rsi
test   $0x1,%sil
jne    1180 <main+0x50>
sar    %rsi
mov    %rsi,%rdx
sub    %rax,%rdx
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
addq   $0xffffffffffffffff,0x8(%rsp)
jne    1190 <main+0x60>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [10 x i8] c"%lld %lld\00"
@.str.2 = [11 x i8] c"%lld %lld\0A\00"
@.str.3 = [12 x i8] c"impossible\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %6)
br label %9
9: ; preds = %42, %0
%10 = load i64, i64* %6
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %45
12: ; preds = %9
store i32 1, i32* %7
%13 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64* %2, i64* %3)
%14 = load i64, i64* %2
%15 = load i64, i64* %3
%16 = icmp slt i64 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %12
store i32 0, i32* %7
br label %33
18: ; preds = %12
%19 = load i64, i64* %2
%20 = load i64, i64* %3
%21 = add nsw i64 %19, %20
store i64 %21, i64* %4
%22 = load i64, i64* %4
%23 = and i64 %22, 1
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %18
store i32 0, i32* %7
br label %32
26: ; preds = %18
%27 = load i64, i64* %4
%28 = ashr i64 %27, 1
store i64 %28, i64* %4
%29 = load i64, i64* %4
%30 = load i64, i64* %3
%31 = sub nsw i64 %29, %30
store i64 %31, i64* %5
br label %32
32: ; preds = %26, %25
br label %33
33: ; preds = %32, %17
%34 = load i32, i32* %7
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %33
%37 = load i64, i64* %4
%38 = load i64, i64* %5
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i64 %37, i64 %38)
br label %42
40: ; preds = %33
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %42
42: ; preds = %40, %36
%43 = load i64, i64* %6
%44 = add nsw i64 %43, -1
store i64 %44, i64* %6
br label %9
45: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [10 x i8] c"%lld %lld\00"
@.str.2 = [11 x i8] c"%lld %lld\0A\00"
@str = [11 x i8] c"impossible\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 i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %3)
%8 = load i64, i64* %3
%9 = icmp eq i64 %8, 0
br i1 %9, label %29, label %10
10: ; preds = %0, %25
%11 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64* %1, i64* %2)
%12 = load i64, i64* %1
%13 = load i64, i64* %2
%14 = icmp slt i64 %12, %13
br i1 %14, label %23, label %15
15: ; preds = %10
%16 = add nsw i64 %13, %12
%17 = and i64 %16, 1
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = ashr i64 %16, 1
%21 = sub nsw i64 %20, %13
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i64 %20, i64 %21)
br label %25
23: ; preds = %10, %15
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %25
25: ; preds = %23, %19
%26 = load i64, i64* %3
%27 = add nsw i64 %26, -1
store i64 %27, i64* %3
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %10
29: ; preds = %25, %0
ret i32 0
}