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

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

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

c = A("c")
b = B("b")
m = C("m")
h = C("h")
f = C("f")
d = A("d")
e = C("e")
i = C("i")
l = C("l")

c.z = b
c.v = b
b.z = e
m.x = b
m.r = b
h.x = b
h.r = b
f.x = b
f.r = b
d.z = b
d.v = b
e.x = b
e.r = b
i.x = b
i.r = b
l.x = b
l.r = b
assert b.z.x.z.x.z.r.z.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.v: B = None
        self.txt = txt

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

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

c = A("c")
b = B("b")
m = C("m")
h = C("h")
f = C("f")
d = A("d")
e = C("e")
i = C("i")
l = C("l")

c.z = b
c.v = b
b.z = e
m.x = b
m.r = b
h.x = b
h.r = b
f.x = b
f.r = b
d.z = b
d.v = b
e.x = b
e.r = b
i.x = b
i.r = b
l.x = b
l.r = b
assert b.z.x.z.x.z.r.z.r.z.txt == "e"