class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.v: A = None
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: A = None
        self.s: C = None
        self.txt = txt

l = A("l")
g = B("g")
a = C("a")
b = A("b")
i = B("i")
k = C("k")
c = B("c")

l.z = a
l.s = a
l.v = b
g.o = k
g.z = k
a.y = l
a.p = b
a.s = k
b.z = a
b.v = l
b.s = k
i.o = a
i.z = k
k.y = l
k.p = b
k.s = a
c.o = k
c.z = a
assert l.v.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.v: A = None
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: A = None
        self.s: C = None
        self.txt = txt

l = A("l")
g = B("g")
a = C("a")
b = A("b")
i = B("i")
k = C("k")
c = B("c")

l.z = a
l.s = a
l.v = b
g.o = k
g.z = k
a.y = l
a.p = b
a.s = k
b.z = a
b.v = l
b.s = k
i.o = a
i.z = k
k.y = l
k.p = b
k.s = a
c.o = k
c.z = a
assert l.v.z.s.txt == "k"