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

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

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

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

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

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

i.x = h
c.q = m
d.o = l
d.t = h
l.z = c
l.w = m
l.r = i
l.x = d
h.o = d
h.w = l
h.t = i
m.z = c
m.w = l
m.r = i
m.x = d
assert l.w.r.x.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

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

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

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

i.x = h
c.q = m
d.o = l
d.t = h
l.z = c
l.w = m
l.r = i
l.x = d
h.o = d
h.w = l
h.t = i
m.z = c
m.w = l
m.r = i
m.x = d
assert l.w.r.x.w.txt == "l"