HandShakes/warnachinka | HandShakes/disfavour | ||||
---|---|---|---|---|---|
n | 1 | x = input() | n | 1 | a = input() |
2 | y = [] | 2 | F = [] | ||
3 | if x: | 3 | if a: | ||
4 | y.append(set(eval(x))) | 4 | F.append(set(eval(a))) | ||
5 | x = input() | 5 | a = input() | ||
6 | while x: | 6 | while a: | ||
7 | x = set(eval(x)) | 7 | a = set(eval(a)) | ||
8 | mark = 0 | 8 | flag = 0 | ||
9 | |||||
9 | for i in tuple(y): | 10 | for item in tuple(F): | ||
11 | |||||
10 | if not i.isdisjoint(x): | 12 | if not item.isdisjoint(a): | ||
11 | mark += 1 | 13 | flag += 1 | ||
14 | |||||
12 | if mark == 1: | 15 | if flag == 1: | ||
13 | i.update(x) | 16 | item.update(a) | ||
14 | t = i | 17 | tmp = item | ||
18 | |||||
15 | else: | 19 | else: | ||
n | 16 | t.update(i) | n | 20 | tmp.update(item) |
17 | y.remove(i) | 21 | F.remove(item) | ||
22 | |||||
18 | if mark == 0: | 23 | if flag == 0: | ||
19 | y.append(x) | 24 | F.append(a) | ||
20 | x = input() | 25 | a = input() | ||
21 | if len(y) != 1: | 26 | if len(F) == 1: | ||
27 | print("YES") | ||||
28 | else: | ||||
22 | print("NO") | 29 | print("NO") | ||
t | 23 | else: | t | ||
24 | print("YES") | ||||
25 | 30 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|