#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*/ freopen(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ reverse(int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  int n, a, b, sum;
  freopen("input.txt", "r", stdin);
  scanf("%d", &n);
  while (n--) {
    scanf("%d%d", &a, &b);
    sum = a + b;
    if ((reverse(a) + reverse(b)) == reverse(sum)) {
      printf("%d\n", sum);
    } else {
      printf("NO\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e8b(%rip),%rax
mov    (%rax),%edx
lea    0xe9a(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1050 <freopen@plt>
lea    0xe95(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     121a <main+0xda>
lea    0xe6d(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%edi
call   1030 <reverse@plt>
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%edi
call   1030 <reverse@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%edi
call   1030 <reverse@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jne    1207 <main+0xc7>
mov    -0x20(%rbp),%esi
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1215 <main+0xd5>
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1184 <main+0x44>
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
mov    0x2e83(%rip),%rax
mov    (%rax),%edx
lea    0xe92(%rip),%rdi
lea    0xe95(%rip),%rsi
call   1060 <freopen@plt>
lea    0xe8d(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
subl   $0x1,0x10(%rsp)
jb     1217 <main+0xc7>
lea    0xe6d(%rip),%r14
lea    0x14(%rsp),%r15
lea    0xc(%rsp),%rbx
jmp    11c3 <main+0x73>
nopl   0x0(%rax,%rax,1)
lea    0xe5e(%rip),%rdi
call   1040 <puts@plt>
subl   $0x1,0x10(%rsp)
jb     1217 <main+0xc7>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x14(%rsp),%edi
mov    0xc(%rsp),%ebp
add    %edi,%ebp
call   1030 <reverse@plt>
mov    %rax,%r12
mov    0xc(%rsp),%edi
call   1030 <reverse@plt>
mov    %rax,%r13
add    %r12,%r13
mov    %ebp,%edi
call   1030 <reverse@plt>
cmp    %rax,%r13
jne    11b0 <main+0x60>
lea    0xe0a(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
subl   $0x1,0x10(%rsp)
jae    11c3 <main+0x73>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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