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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.o: D = None
        self.p: D = None
        self.q: A = None
        self.u: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

m = A("m")
l = B("l")
d = C("d")
i = D("i")
b = E("b")
h = A("h")

m.s = d
m.u = l
m.o = b
m.z = i
l.y = i
l.o = i
l.p = i
l.q = m
l.u = d
d.r = l
i.o = b
i.r = b
b.t = h
h.s = d
h.u = l
h.o = b
h.z = i
assert d.r.p.o.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: B = None
        self.o: E = None
        self.z: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.o: D = None
        self.p: D = None
        self.q: A = None
        self.u: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

m = A("m")
l = B("l")
d = C("d")
i = D("i")
b = E("b")
h = A("h")

m.s = d
m.u = l
m.o = b
m.z = i
l.y = i
l.o = i
l.p = i
l.q = m
l.u = d
d.r = l
i.o = b
i.r = b
b.t = h
h.s = d
h.u = l
h.o = b
h.z = i
assert d.r.p.o.t.o.txt == "b"