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

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

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

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: C = None
        self.u: E = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: C = None
        self.u: E = None
        self.txt = txt

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

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

a.z = i
a.q = i
a.y = l
i.s = d
i.o = d
i.q = l
d.r = b
d.w = l
b.r = a
b.w = d
b.u = l
l.p = i
assert d.r.u.p.o.txt == "d"