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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.w: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.p: D = None
        self.y: A = None
        self.txt = txt

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

m = A("m")
b = B("b")
k = C("k")
a = D("a")
l = E("l")
h = D("h")
e = D("e")

m.z = k
b.s = m
b.w = l
k.o = m
k.p = m
a.v = l
a.p = h
a.y = m
l.z = b
l.q = b
h.v = l
h.p = e
h.y = m
e.v = l
e.p = h
e.y = m
assert a.p.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.w: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.p: D = None
        self.y: A = None
        self.txt = txt

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

m = A("m")
b = B("b")
k = C("k")
a = D("a")
l = E("l")
h = D("h")
e = D("e")

m.z = k
b.s = m
b.w = l
k.o = m
k.p = m
a.v = l
a.p = h
a.y = m
l.z = b
l.q = b
h.v = l
h.p = e
h.y = m
e.v = l
e.p = h
e.y = m
assert a.p.v.z.txt == "b"