#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 scanf(char *, int *, ...);
int main(void) {
  int i, j, m, n, input, flag = 0;
  int tmp;
  while (scanf("%d %d", &m, &n) == 2) {
    if (scanf("%d", &input) == 1) {
      for (i = 0; i < m; i++) {
        for (j = 0; j < n; j++) {
          if (scanf("%d", &tmp) == 1) {
            if (tmp == input) {
              flag = 1;
            }
          }
        }
      }
      if (flag)
        printf("Yes\n");
      else
        printf("No\n");
      flag = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    1222 <main+0x102>
lea    0xea7(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    121d <main+0xfd>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11ef <main+0xcf>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11dc <main+0xbc>
lea    0xe66(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11c9 <main+0xa9>
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    11c4 <main+0xa4>
movl   $0x1,-0x1c(%rbp)
jmp    11c9 <main+0xa9>
jmp    11ce <main+0xae>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118a <main+0x6a>
jmp    11e1 <main+0xc1>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1177 <main+0x57>
cmpl   $0x0,-0x1c(%rbp)
je     120a <main+0xea>
lea    0xe06(%rip),%rdi
call   1030 <printf@plt>
jmp    1216 <main+0xf6>
lea    0xdfa(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
jmp    1136 <main+0x16>
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    0xecb(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    1236 <main+0x116>
lea    0xead(%rip),%r15
lea    0x10(%rsp),%r12
lea    0x14(%rsp),%rbx
mov    $0x1,%r14d
lea    0xe93(%rip),%r13
lea    0x8(%rsp),%rbp
jmp    11a7 <main+0x87>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xe7f(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    1236 <main+0x116>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    118c <main+0x6c>
mov    0x8(%rsp),%ecx
test   %ecx,%ecx
jle    1180 <main+0x60>
xor    %r12d,%r12d
mov    0xc(%rsp),%eax
xor    %r13d,%r13d
jmp    11d9 <main+0xb9>
nopl   (%rax)
add    $0x1,%r13d
cmp    %ecx,%r13d
jge    1210 <main+0xf0>
test   %eax,%eax
jle    11d0 <main+0xb0>
xor    %ebp,%ebp
nop
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x14(%rsp),%ecx
xor    0x10(%rsp),%ecx
xor    $0x1,%eax
or     %eax,%ecx
cmove  %r14d,%r12d
add    $0x1,%ebp
mov    0xc(%rsp),%eax
cmp    %eax,%ebp
jl     11e0 <main+0xc0>
mov    0x8(%rsp),%ecx
jmp    11d0 <main+0xb0>
nop
lea    0xdf2(%rip),%rdi
test   %r12d,%r12d
lea    0x10(%rsp),%r12
lea    0xdda(%rip),%r13
lea    0x8(%rsp),%rbp
jne    1187 <main+0x67>
jmp    1180 <main+0x60>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [5 x i8] c"Yes\0A\00"
@.str.3 = [4 x i8] c"No\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
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %7
br label %9
9: ; preds = %50, %0
%10 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %5)
%11 = icmp eq i32 %10, 2
br i1 %11, label %12, label %51
12: ; preds = %9
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %50
15: ; preds = %12
store i32 0, i32* %2
br label %16
16: ; preds = %39, %15
%17 = load i32, i32* %2
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %42
20: ; preds = %16
store i32 0, i32* %3
br label %21
21: ; preds = %35, %20
%22 = load i32, i32* %3
%23 = load i32, i32* %5
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %38
25: ; preds = %21
%26 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %34
28: ; preds = %25
%29 = load i32, i32* %8
%30 = load i32, i32* %6
%31 = icmp eq i32 %29, %30
br i1 %31, label %32, label %33
32: ; preds = %28
store i32 1, i32* %7
br label %33
33: ; preds = %32, %28
br label %34
34: ; preds = %33, %25
br label %35
35: ; preds = %34
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %21
38: ; preds = %21
br label %39
39: ; preds = %38
%40 = load i32, i32* %2
%41 = add nsw i32 %40, 1
store i32 %41, i32* %2
br label %16
42: ; preds = %16
%43 = load i32, i32* %7
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %42
%46 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %49
47: ; preds = %42
%48 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %49
49: ; preds = %47, %45
store i32 0, i32* %7
br label %50
50: ; preds = %49, %12
br label %9
51: ; preds = %9
ret i32 0
}

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