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