program main
  implicit none
  integer :: n, i, j, k, a(3, 3), b(10)
  logical :: chosen(3, 3), bingo
  do i = 1, 3
    read (*, *) a(:, i)
  end do
  read (*, *) n
  do k = 1, n
    read (*, *) b(k)
  end do

  chosen(:, :) = .false.
  do k = 1, n
    do i = 1, 3
      do j = 1, 3
        if (a(j, i) == b(k)) chosen(j, i) = .true.
      end do
    end do
  end do

  bingo = .false.
  do i = 1, 3
    bingo = bingo .or. (chosen(1, i) .and. chosen(2, i) .and. chosen(3, i))
    bingo = bingo .or. (chosen(i, 1) .and. chosen(i, 2) .and. chosen(i, 3))
  end do
  bingo = bingo .or. (chosen(1, 1) .and. chosen(2, 2) .and. chosen(3, 3))
  bingo = bingo .or. (chosen(3, 1) .and. chosen(2, 2) .and. chosen(1, 3))
  if (bingo) then
    write (*, "(a)") "Yes"
  else
    write (*, "(a)") "No"
  end if
end program main

; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QFEa = internal global [3 x [3 x i32]] undef
@_QFEb = internal global [10 x i32] undef
@_QQcl.88a4bff5912faafc41a410cbfc68787f = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_2263/source.f\00"
@_QQcl.286129 = linkonce constant [3 x i8] c"(a)"
@_QQcl.596573 = linkonce constant [3 x i8] c"Yes"
@_QQcl.4E6F = linkonce constant [2 x i8] c"No"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca i32, align 4
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 2
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 3
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 5
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 6
  %.fca.7.0.0.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 0
  %.fca.7.0.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 1
  %.fca.7.0.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 2
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.88a4bff5912faafc41a410cbfc68787f, i32 6)
  store ptr @_QFEa, ptr %1, align 8, !tbaa !3
  store i64 4, ptr %.fca.1.gep, align 8, !tbaa !3
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !3
  store i8 9, ptr %.fca.4.gep, align 1, !tbaa !3
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !3
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !3
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !3
  store i64 3, ptr %.fca.7.0.1.gep, align 8, !tbaa !3
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !3
  %4 = call i1 @_FortranAioInputDescriptor(ptr %3, ptr nonnull %1)
  %5 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %6 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.88a4bff5912faafc41a410cbfc68787f, i32 6)
  store ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEa, i64 0, i64 1, i64 0), ptr %1, align 8, !tbaa !3
  store i64 4, ptr %.fca.1.gep, align 8, !tbaa !3
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !3
  store i8 9, ptr %.fca.4.gep, align 1, !tbaa !3
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !3
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !3
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !3
  store i64 3, ptr %.fca.7.0.1.gep, align 8, !tbaa !3
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !3
  %7 = call i1 @_FortranAioInputDescriptor(ptr %6, ptr nonnull %1)
  %8 = call i32 @_FortranAioEndIoStatement(ptr %6)
  %9 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.88a4bff5912faafc41a410cbfc68787f, i32 6)
  store ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEa, i64 0, i64 2, i64 0), ptr %1, align 8, !tbaa !3
  store i64 4, ptr %.fca.1.gep, align 8, !tbaa !3
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !3
  store i8 9, ptr %.fca.4.gep, align 1, !tbaa !3
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !3
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !3
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !3
  store i64 3, ptr %.fca.7.0.1.gep, align 8, !tbaa !3
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !3
  %10 = call i1 @_FortranAioInputDescriptor(ptr %9, ptr nonnull %1)
  %11 = call i32 @_FortranAioEndIoStatement(ptr %9)
  %12 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.88a4bff5912faafc41a410cbfc68787f, i32 8)
  %13 = call i1 @_FortranAioInputInteger(ptr %12, ptr nonnull %2, i32 4)
  %14 = call i32 @_FortranAioEndIoStatement(ptr %12)
  %15 = load i32, ptr %2, align 4, !tbaa !7
  %16 = sext i32 %15 to i64
  %17 = icmp sgt i32 %15, 0
  br i1 %17, label %.lr.ph, label %.preheader

.preheader30:                                     ; preds = %.lr.ph
  %.pre = load i32, ptr %2, align 4, !tbaa !7
  %.pre50 = sext i32 %.pre to i64
  %18 = icmp sgt i32 %.pre, 0
  br i1 %18, label %.preheader28.preheader, label %.preheader

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %19 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.88a4bff5912faafc41a410cbfc68787f, i32 10)
  %20 = add nsw i64 %indvars.iv, -1
  %21 = getelementptr [10 x i32], ptr @_QFEb, i64 0, i64 %20
  %22 = call i1 @_FortranAioInputInteger(ptr %19, ptr %21, i32 4)
  %23 = call i32 @_FortranAioEndIoStatement(ptr %19)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %16
  br i1 %exitcond.not, label %.preheader30, label %.lr.ph

.preheader28.preheader:                           ; preds = %.preheader30
  %.pre49 = load i32, ptr @_QFEa, align 16, !tbaa !7
  %24 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEa, i64 0, i64 0, i64 1), align 4, !tbaa !7
  %25 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEa, i64 0, i64 0, i64 2), align 8, !tbaa !7
  %26 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEa, i64 0, i64 1, i64 0), align 4, !tbaa !7
  %27 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEa, i64 0, i64 1, i64 1), align 16, !tbaa !7
  %28 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEa, i64 0, i64 1, i64 2), align 4, !tbaa !7
  %29 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEa, i64 0, i64 2, i64 0), align 8, !tbaa !7
  %30 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEa, i64 0, i64 2, i64 1), align 4, !tbaa !7
  %31 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @_QFEa, i64 0, i64 2, i64 2), align 16, !tbaa !7
  br label %.preheader28

.preheader28:                                     ; preds = %.preheader28.preheader, %.preheader28
  %32 = phi i32 [ 0, %.preheader28.preheader ], [ %60, %.preheader28 ]
  %33 = phi i32 [ 0, %.preheader28.preheader ], [ %58, %.preheader28 ]
  %34 = phi i32 [ 0, %.preheader28.preheader ], [ %54, %.preheader28 ]
  %35 = phi i32 [ 0, %.preheader28.preheader ], [ %52, %.preheader28 ]
  %36 = phi i32 [ 0, %.preheader28.preheader ], [ %56, %.preheader28 ]
  %37 = phi i32 [ 0, %.preheader28.preheader ], [ %50, %.preheader28 ]
  %38 = phi i32 [ 0, %.preheader28.preheader ], [ %48, %.preheader28 ]
  %39 = phi i32 [ 0, %.preheader28.preheader ], [ %46, %.preheader28 ]
  %40 = phi i32 [ 0, %.preheader28.preheader ], [ %spec.select, %.preheader28 ]
  %indvars.iv42 = phi i64 [ 1, %.preheader28.preheader ], [ %indvars.iv.next43, %.preheader28 ]
  %41 = add nsw i64 %indvars.iv42, -1
  %42 = getelementptr [10 x i32], ptr @_QFEb, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !7
  %44 = icmp eq i32 %.pre49, %43
  %spec.select = select i1 %44, i32 1, i32 %40
  %45 = icmp eq i32 %24, %43
  %46 = select i1 %45, i32 1, i32 %39
  %47 = icmp eq i32 %25, %43
  %48 = select i1 %47, i32 1, i32 %38
  %49 = icmp eq i32 %26, %43
  %50 = select i1 %49, i32 1, i32 %37
  %51 = icmp eq i32 %27, %43
  %52 = select i1 %51, i32 1, i32 %35
  %53 = icmp eq i32 %28, %43
  %54 = select i1 %53, i32 1, i32 %34
  %55 = icmp eq i32 %29, %43
  %56 = select i1 %55, i32 1, i32 %36
  %57 = icmp eq i32 %30, %43
  %58 = select i1 %57, i32 1, i32 %33
  %59 = icmp eq i32 %31, %43
  %60 = select i1 %59, i32 1, i32 %32
  %indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
  %exitcond45.not = icmp eq i64 %indvars.iv42, %.pre50
  br i1 %exitcond45.not, label %.preheader.loopexit, label %.preheader28

.preheader.loopexit:                              ; preds = %.preheader28
  %61 = icmp ne i32 %spec.select, 0
  %62 = icmp ne i32 %46, 0
  %63 = icmp ne i32 %48, 0
  %64 = icmp ne i32 %50, 0
  %65 = icmp ne i32 %56, 0
  %66 = icmp ne i32 %52, 0
  %67 = icmp ne i32 %54, 0
  %68 = icmp ne i32 %58, 0
  %69 = icmp ne i32 %60, 0
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %0, %.preheader30
  %70 = phi i1 [ false, %.preheader30 ], [ false, %0 ], [ %69, %.preheader.loopexit ]
  %71 = phi i1 [ false, %.preheader30 ], [ false, %0 ], [ %68, %.preheader.loopexit ]
  %72 = phi i1 [ false, %.preheader30 ], [ false, %0 ], [ %67, %.preheader.loopexit ]
  %73 = phi i1 [ false, %.preheader30 ], [ false, %0 ], [ %66, %.preheader.loopexit ]
  %74 = phi i1 [ false, %.preheader30 ], [ false, %0 ], [ %65, %.preheader.loopexit ]
  %75 = phi i1 [ false, %.preheader30 ], [ false, %0 ], [ %64, %.preheader.loopexit ]
  %76 = phi i1 [ false, %.preheader30 ], [ false, %0 ], [ %63, %.preheader.loopexit ]
  %77 = phi i1 [ false, %.preheader30 ], [ false, %0 ], [ %62, %.preheader.loopexit ]
  %78 = phi i1 [ false, %.preheader30 ], [ false, %0 ], [ %61, %.preheader.loopexit ]
  %79 = and i1 %78, %77
  %80 = and i1 %79, %76
  %81 = and i1 %78, %75
  %82 = and i1 %81, %74
  %83 = or i1 %80, %82
  %84 = and i1 %75, %73
  %85 = and i1 %84, %72
  %86 = or i1 %83, %85
  %87 = and i1 %77, %73
  %88 = and i1 %87, %71
  %89 = or i1 %86, %88
  %90 = and i1 %74, %71
  %91 = and i1 %76, %72
  %92 = or i1 %90, %91
  %93 = and i1 %92, %70
  %94 = or i1 %89, %93
  %95 = and i1 %78, %70
  %96 = and i1 %76, %74
  %97 = or i1 %95, %96
  %98 = and i1 %73, %97
  %99 = or i1 %94, %98
  br i1 %99, label %100, label %103

100:                                              ; preds = %.preheader
  %101 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.286129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.88a4bff5912faafc41a410cbfc68787f, i32 30)
  %102 = call i1 @_FortranAioOutputAscii(ptr %101, ptr nonnull @_QQcl.596573, i64 3)
  br label %106

103:                                              ; preds = %.preheader
  %104 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.286129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.88a4bff5912faafc41a410cbfc68787f, i32 32)
  %105 = call i1 @_FortranAioOutputAscii(ptr %104, ptr nonnull @_QQcl.4E6F, i64 2)
  br label %106

106:                                              ; preds = %100, %103
  %.sink = phi ptr [ %101, %100 ], [ %104, %103 ]
  %107 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  ret void
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare i1 @_FortranAioInputInteger(ptr, ptr, i32) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputAscii(ptr, ptr, i64) local_unnamed_addr

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"descriptor member", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
!7 = !{!8, !8, i64 0}
!8 = !{!"any data access", !5, i64 0}
