#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 strlen(char *);
int main() {
  char s[1002][13], num[13];
  int t, n, i, j, k, count;
  scanf("%d", &t);
  for (i = 1; i <= t; i++) {
    scanf("%d", &n);
    for (j = 0; j < n; j++)
      scanf("%s", s[j]);
    scanf("%s", num);
    printf("Case %d:\n", i);
    for (j = 0; j < n; j++) {
      count = 0;
      for (k = 0; k < strlen(num); k++) {
        if (s[j][k] != num[k])
          count++;
      }
      if (count <= 1)
        printf("%s\n", s[j]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3320,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x3304(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x1,-0x330c(%rbp)
mov    -0x330c(%rbp),%eax
cmp    -0x3304(%rbp),%eax
jg     131d <main+0x1ed>
lea    0xe86(%rip),%rdi
lea    -0x3308(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x3310(%rbp)
mov    -0x3310(%rbp),%eax
cmp    -0x3308(%rbp),%eax
jge    11db <main+0xab>
movslq -0x3310(%rbp),%rax
lea    -0x32f0(%rbp),%rsi
imul   $0xd,%rax,%rax
add    %rax,%rsi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x3310(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3310(%rbp)
jmp    1192 <main+0x62>
lea    -0x32fd(%rbp),%rsi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x330c(%rbp),%esi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x3310(%rbp)
mov    -0x3310(%rbp),%eax
cmp    -0x3308(%rbp),%eax
jge    1304 <main+0x1d4>
movl   $0x0,-0x3318(%rbp)
movl   $0x0,-0x3314(%rbp)
mov    -0x3314(%rbp),%eax
mov    %eax,-0x331c(%rbp)
lea    -0x32fd(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x331c(%rbp),%eax
cmp    %ecx,%eax
jge    12bb <main+0x18b>
movslq -0x3310(%rbp),%rcx
lea    -0x32f0(%rbp),%rax
imul   $0xd,%rcx,%rcx
add    %rcx,%rax
movslq -0x3314(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movslq -0x3314(%rbp),%rcx
movsbl -0x32fd(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
je     12a2 <main+0x172>
mov    -0x3318(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3318(%rbp)
jmp    12a7 <main+0x177>
mov    -0x3314(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3314(%rbp)
jmp    1234 <main+0x104>
cmpl   $0x1,-0x3318(%rbp)
jg     12eb <main+0x1bb>
movslq -0x3310(%rbp),%rax
lea    -0x32f0(%rbp),%rsi
imul   $0xd,%rax,%rax
add    %rax,%rsi
lea    0xd2c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12f0 <main+0x1c0>
mov    -0x3310(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3310(%rbp)
jmp    120e <main+0xde>
jmp    1309 <main+0x1d9>
mov    -0x330c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x330c(%rbp)
jmp    1161 <main+0x31>
xor    %eax,%eax
add    $0x3320,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3308,%rsp
lea    0xea8(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    129c <main+0x15c>
mov    $0x1,%ebp
lea    0xe88(%rip),%r13
lea    0x13(%rsp),%r15
jmp    11a4 <main+0x64>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x8(%rsp),%rcx
lea    0x1(%rcx),%eax
cmp    0x4(%rsp),%ecx
mov    %eax,%ebp
jge    129c <main+0x15c>
lea    0xe55(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x0,(%rsp)
jle    11ee <main+0xae>
lea    0x20(%rsp),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
add    $0x1,%rbx
movslq (%rsp),%rax
add    $0xd,%r14
cmp    %rax,%rbx
jl     11d0 <main+0x90>
mov    %r13,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe04(%rip),%rdi
mov    %rbp,0x8(%rsp)
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x0,(%rsp)
jle    1190 <main+0x50>
lea    0x20(%rsp),%rbp
xor    %r14d,%r14d
jmp    125a <main+0x11a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%r14,%r14,2),%rax
lea    (%r14,%rax,4),%rax
lea    (%rsp,%rax,1),%rdi
add    $0x20,%rdi
call   1030 <puts@plt>
add    $0x1,%r14
movslq (%rsp),%rax
add    $0xd,%rbp
cmp    %rax,%r14
jge    1190 <main+0x50>
mov    %r15,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1230 <main+0xf0>
xor    %ebx,%ebx
xor    %r12d,%r12d
nopl   0x0(%rax,%rax,1)
movzbl 0x0(%rbp,%rbx,1),%eax
xor    %ecx,%ecx
cmp    0x13(%rsp,%rbx,1),%al
setne  %cl
add    %ecx,%r12d
add    $0x1,%rbx
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1270 <main+0x130>
cmp    $0x1,%r12d
jbe    1230 <main+0xf0>
jmp    1245 <main+0x105>
xor    %eax,%eax
add    $0x3308,%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 = [3 x i8] c"%s\00"
@.str.2 = [10 x i8] c"Case %d:\0A\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1002 x [13 x i8]]
%3 = alloca [13 x i8]
%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*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
store i32 1, i32* %6
br label %11
11: ; preds = %81, %0
%12 = load i32, i32* %6
%13 = load i32, i32* %4
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %84
15: ; preds = %11
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
store i32 0, i32* %7
br label %17
17: ; preds = %27, %15
%18 = load i32, i32* %7
%19 = load i32, i32* %5
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %30
21: ; preds = %17
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [1002 x [13 x i8]], [1002 x [13 x i8]]* %2, i64 0, i64 %23
%25 = getelementptr inbounds [13 x i8], [13 x i8]* %24, i64 0, i64 0
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %25)
br label %27
27: ; preds = %21
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
store i32 %29, i32* %7
br label %17
30: ; preds = %17
%31 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = load i32, i32* %6
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %33)
store i32 0, i32* %7
br label %35
35: ; preds = %77, %30
%36 = load i32, i32* %7
%37 = load i32, i32* %5
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %80
39: ; preds = %35
store i32 0, i32* %9
store i32 0, i32* %8
br label %40
40: ; preds = %64, %39
%41 = load i32, i32* %8
%42 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
%43 = call i32 @strlen(i8* %42)
%44 = icmp slt i32 %41, %43
br i1 %44, label %45, label %67
45: ; preds = %40
%46 = load i32, i32* %7
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [1002 x [13 x i8]], [1002 x [13 x i8]]* %2, i64 0, i64 %47
%49 = load i32, i32* %8
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [13 x i8], [13 x i8]* %48, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = load i32, i32* %8
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 %55
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = icmp ne i32 %53, %58
br i1 %59, label %60, label %63
60: ; preds = %45
%61 = load i32, i32* %9
%62 = add nsw i32 %61, 1
store i32 %62, i32* %9
br label %63
63: ; preds = %60, %45
br label %64
64: ; preds = %63
%65 = load i32, i32* %8
%66 = add nsw i32 %65, 1
store i32 %66, i32* %8
br label %40
67: ; preds = %40
%68 = load i32, i32* %9
%69 = icmp sle i32 %68, 1
br i1 %69, label %70, label %76
70: ; preds = %67
%71 = load i32, i32* %7
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [1002 x [13 x i8]], [1002 x [13 x i8]]* %2, i64 0, i64 %72
%74 = getelementptr inbounds [13 x i8], [13 x i8]* %73, i64 0, i64 0
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %74)
br label %76
76: ; preds = %70, %67
br label %77
77: ; preds = %76
%78 = load i32, i32* %7
%79 = add nsw i32 %78, 1
store i32 %79, i32* %7
br label %35
80: ; preds = %35
br label %81
81: ; preds = %80
%82 = load i32, i32* %6
%83 = add nsw i32 %82, 1
store i32 %83, i32* %6
br label %11
84: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [10 x i8] c"Case %d:\0A\00"
define i32 @main() {
%1 = alloca [1002 x [13 x i8]]
%2 = alloca [13 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = getelementptr inbounds [1002 x [13 x i8]], [1002 x [13 x i8]]* %1, i64 0, i64 0, i64 0
%6 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 1
br i1 %11, label %62, label %12
12: ; preds = %0, %58
%13 = phi i32 [ %59, %58 ], [ 1, %0 ]
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %25
17: ; preds = %12, %17
%18 = phi i64 [ %21, %17 ], [ 0, %12 ]
%19 = getelementptr inbounds [1002 x [13 x i8]], [1002 x [13 x i8]]* %1, i64 0, i64 %18, i64 0
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = add nuw nsw i64 %18, 1
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = icmp slt i64 %21, %23
br i1 %24, label %17, label %25
25: ; preds = %17, %12
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%28 = load i32, i32* %4
%29 = icmp sgt i32 %28, 0
br i1 %29, label %30, label %58
30: ; preds = %25, %53
%31 = phi i64 [ %54, %53 ], [ 0, %25 ]
%32 = call i32 @strlen(i8* %6)
%33 = icmp sgt i32 %32, 0
br i1 %33, label %34, label %50
34: ; preds = %30, %34
%35 = phi i64 [ %44, %34 ], [ 0, %30 ]
%36 = phi i32 [ %43, %34 ], [ 0, %30 ]
%37 = getelementptr inbounds [1002 x [13 x i8]], [1002 x [13 x i8]]* %1, i64 0, i64 %31, i64 %35
%38 = load i8, i8* %37
%39 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 %35
%40 = load i8, i8* %39
%41 = icmp ne i8 %38, %40
%42 = zext i1 %41 to i32
%43 = add nuw nsw i32 %36, %42
%44 = add nuw nsw i64 %35, 1
%45 = call i32 @strlen(i8* %6)
%46 = sext i32 %45 to i64
%47 = icmp slt i64 %44, %46
br i1 %47, label %34, label %48
48: ; preds = %34
%49 = icmp ult i32 %43, 2
br i1 %49, label %50, label %53
50: ; preds = %30, %48
%51 = getelementptr inbounds [1002 x [13 x i8]], [1002 x [13 x i8]]* %1, i64 0, i64 %31, i64 0
%52 = call i32 @puts(i8* %51)
br label %53
53: ; preds = %48, %50
%54 = add nuw nsw i64 %31, 1
%55 = load i32, i32* %4
%56 = sext i32 %55 to i64
%57 = icmp slt i64 %54, %56
br i1 %57, label %30, label %58
58: ; preds = %53, %25
%59 = add nuw nsw i32 %13, 1
%60 = load i32, i32* %3
%61 = icmp slt i32 %13, %60
br i1 %61, label %12, label %62
62: ; preds = %58, %0
ret i32 0
}