a = {}
for i = 1, 9 do
  a[i] = io.read("*n")
end
n = io.read("*n")
t = {}
for i = 1, n do
  v = io.read("*n")
  t[v] = true
end
z = {
  {1, 2, 3},
  {4, 5, 6},
  {7, 8, 9},
  {1, 4, 7},
  {2, 5, 8},
  {3, 6, 9},
  {1, 5, 9},
  {3, 5, 7}
}
v = false
for i = 1, 8 do
  if t[a[z[i][1]]] and t[a[z[i][2]]] and t[a[z[i][3]]] then
    v = true
  end
end
print(v and "Yes" or "No")
