HandShakes/Stephan
HandShakes/warnachinka
n1a = input()n1x = input()
2b = []2y = []
3if a:3if x:
4    b.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        s = 08        mark = 0
9 
10        for i in tuple(b):9        for i in tuple(y):
11            if not i.isdisjoint(a):10            if not i.isdisjoint(x):
12                s += 111                mark += 1
13 
14                if s == 1:12                if mark == 1:
15                    i.update(a)13                    i.update(x)
16                    t = i14                    t = i
17                else:15                else:
18                    t.update(i)16                    t.update(i)
t19                    b.remove(i)t17                    y.remove(i)
20        if s == 0:18        if mark == 0:
21            b.append(a)19            y.append(x)
22        a = input()20        x = input()
23    if len(b) != 1:21    if len(y) != 1:
24 
25        print("NO")22        print("NO")
26    else:23    else:
27        print("YES")24        print("YES")
2825
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op