#a445
n, m, q = map(int,input().split())
my_list = []
for i in range(m):
my_list.append(set(map(int,input().split())))
#print(my_list)
new_list = []
for i in range(len(my_list)):
for j in range(i,len(my_list)):
if my_list[i] & my_list[j] != set():
new_list.append((my_list[i].union(my_list[j])))
if my_list[i] & my_list[j] == set():
if my_list[j] not in new_list:
new_list.append(my_list[j])
#print(new_list)
#print(new_list)
#[{1,2,5},{3,4,6,8},{8,6,7}]
for i in range(len(new_list)):
for j in range(i+1,len(new_list)):
if new_list[i] & new_list[j] != set():
new_list[i] = new_list[i].union(new_list[j])
new_list[j] = new_list[i].union(new_list[j])
for i in range(len(new_list)):
for j in range(len(new_list)):
if i != j:
if new_list[i] == new_list[j]:
new_list[j] = 0
while 0 in new_list:
new_list.remove(0)
for i in range(q):
setq = set(map(int,input().split()))
for j in range(len(new_list)):
if setq.issubset(new_list[j]):
print(":)")
break
else: # else in For loop ch6 p81
print(":(")