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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

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

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

h.o = f
h.t = m
h.u = d
h.z = d
m.w = f
d.o = e
f.z = e
f.w = h
f.t = d
e.t = f
e.s = f
e.q = m
e.o = m
e.u = h
assert e.o.w.w.txt == "h"