let () =
  let num_card =
    Array.init 3 @@ fun _ ->
      Array.init 3 @@ fun i -> 
        if i = 2 
        then Scanf.scanf " %d\n" Fun.id
        else Scanf.scanf " %d" Fun.id in
  let bingo = Array.make_matrix 3 3 false in
  Scanf.scanf "%d\n" @@ fun n ->
  for i = 0 to n - 1 do
    Scanf.scanf "%d\n" @@ fun b ->
    for i = 0 to 2 do
      for j = 0 to 2 do
        if num_card.(i).(j) = b then bingo.(i).(j) <- true
      done
    done
  done;
  print_endline @@
  if
    bingo.(0) = [| true; true; true |] ||
    bingo.(1) = [| true; true; true |] ||
    bingo.(2) = [| true; true; true |] ||
    Array.init 3 (fun i -> bingo.(i).(0)) = [| true; true; true |] ||
    Array.init 3 (fun i -> bingo.(i).(1)) = [| true; true; true |] ||
    Array.init 3 (fun i -> bingo.(i).(2)) = [| true; true; true |] ||
    Array.init 3 (fun i -> bingo.(i).(i)) = [| true; true; true |] ||
    Array.init 3 (fun i -> bingo.(i).(2-i)) = [| true; true; true |]
  then "Yes"
  else "No"