class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

k = A("k")
m = B("m")
b = C("b")
j = A("j")
e = A("e")
l = B("l")

k.x = l
m.z = e
m.o = b
b.s = e
j.x = m
e.x = m
l.z = j
l.o = b
assert l.o.s.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

k = A("k")
m = B("m")
b = C("b")
j = A("j")
e = A("e")
l = B("l")

k.x = l
m.z = e
m.o = b
b.s = e
j.x = m
e.x = m
l.z = j
l.o = b
assert l.o.s.x.z.txt == "e"