#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 num_cases;
  int sum, diff;
  int score_win, score_lose;
  scanf("%d\n", &num_cases);
  while (num_cases-- > 0) {
    scanf("%d %d\n", &sum, &diff);
    score_win = (sum + diff) / 2;
    score_lose = sum - score_win;
    if (score_win < 0 || score_lose < 0 || (score_win - score_lose) != diff) {
      printf("impossible\n");
    } else {
      printf("%d %d\n", score_win, score_lose);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecd(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jle    11d4 <main+0xb4>
lea    0xea4(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11a8 <main+0x88>
cmpl   $0x0,-0x18(%rbp)
jl     11a8 <main+0x88>
mov    -0x14(%rbp),%eax
sub    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     11bb <main+0x9b>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11cf <main+0xaf>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1141 <main+0x21>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xec1(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
test   %eax,%eax
jle    11d8 <main+0xa8>
lea    0xe9c(%rip),%rbx
lea    0x14(%rsp),%r14
lea    0x10(%rsp),%r15
lea    0xe92(%rip),%r12
jmp    1197 <main+0x67>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
test   %eax,%eax
jle    11d8 <main+0xa8>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x14(%rsp),%edx
mov    0x10(%rsp),%eax
lea    (%rax,%rdx,1),%ecx
cmp    $0xffffffff,%ecx
jl     1180 <main+0x50>
mov    %ecx,%esi
shr    $0x1f,%esi
add    %ecx,%esi
sar    %esi
sub    %esi,%edx
js     1180 <main+0x50>
mov    %esi,%ecx
sub    %edx,%ecx
cmp    %eax,%ecx
jne    1180 <main+0x50>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1188 <main+0x58>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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