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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: C = None
        self.p: A = None
        self.u: D = None
        self.s: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: A = None
        self.w: E = None
        self.s: A = None
        self.q: B = None
        self.txt = txt

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

e = A("e")
h = B("h")
b = C("b")
f = D("f")
d = E("d")

e.z = b
h.r = e
h.p = e
h.x = b
h.s = b
h.u = f
b.t = f
b.o = h
b.x = h
f.x = b
f.r = e
f.s = e
f.w = d
f.q = h
d.q = f
d.o = b
d.u = h
d.z = h
d.w = e
assert b.o.p.z.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: C = None
        self.p: A = None
        self.u: D = None
        self.s: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: A = None
        self.w: E = None
        self.s: A = None
        self.q: B = None
        self.txt = txt

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

e = A("e")
h = B("h")
b = C("b")
f = D("f")
d = E("d")

e.z = b
h.r = e
h.p = e
h.x = b
h.s = b
h.u = f
b.t = f
b.o = h
b.x = h
f.x = b
f.r = e
f.s = e
f.w = d
f.q = h
d.q = f
d.o = b
d.u = h
d.z = h
d.w = e
assert b.o.p.z.x.x.txt == "b"