#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 a, b, x, y, i = 1, j;
  scanf("%d", &j);
  while (i <= j) {
    scanf("%d %d", &a, &b);
    if (a >= b && (a + b) % 2 == 0) {
      x = (a + b) / 2;
      y = (a - b) / 2;
      printf("%d %d\n", x, y);
    } else
      printf("impossible\n");
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x18(%rbp)
lea    0xec6(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     11e4 <main+0xc4>
lea    0xea5(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     11c8 <main+0xa8>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11c8 <main+0xa8>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d6 <main+0xb6>
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1148 <main+0x28>
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    0xebe(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11d4 <main+0xa4>
lea    0xea1(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%rbx
lea    0xe9d(%rip),%r12
lea    0xe8f(%rip),%r13
xor    %ebp,%ebp
jmp    1191 <main+0x61>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    11d4 <main+0xa4>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x14(%rsp),%edx
mov    0x10(%rsp),%ecx
mov    %edx,%eax
sub    %ecx,%eax
jl     1180 <main+0x50>
add    %edx,%ecx
test   $0x1,%cl
jne    1180 <main+0x50>
mov    %ecx,%esi
shr    $0x1f,%esi
add    %ecx,%esi
sar    %esi
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
sar    %edx
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 = [7 x i8] c"%d %d\0A\00"
@.str.3 = [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
%7 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %6
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
br label %9
9: ; preds = %38, %0
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %41
13: ; preds = %9
%14 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = icmp sge i32 %15, %16
br i1 %17, label %18, label %36
18: ; preds = %13
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = add nsw i32 %19, %20
%22 = srem i32 %21, 2
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %36
24: ; preds = %18
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = add nsw i32 %25, %26
%28 = sdiv i32 %27, 2
store i32 %28, i32* %4
%29 = load i32, i32* %2
%30 = load i32, i32* %3
%31 = sub nsw i32 %29, %30
%32 = sdiv i32 %31, 2
store i32 %32, i32* %5
%33 = load i32, i32* %4
%34 = load i32, i32* %5
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %33, i32 %34)
br label %38
36: ; preds = %18, %13
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %38
38: ; preds = %36, %24
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %9
41: ; preds = %9
ret i32 0
}

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