class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.x: A = None
        self.z: D = 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.z: D = None
        self.txt = txt

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

m = A("m")
g = B("g")
h = C("h")
a = D("a")
c = A("c")
e = D("e")
l = D("l")

m.u = e
m.z = e
m.x = c
g.w = e
h.z = e
a.q = g
a.v = h
c.u = l
c.x = m
c.z = e
e.q = g
e.v = h
l.q = g
l.v = h
assert e.q.w.q.w.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.x: A = None
        self.z: D = 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.z: D = None
        self.txt = txt

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

m = A("m")
g = B("g")
h = C("h")
a = D("a")
c = A("c")
e = D("e")
l = D("l")

m.u = e
m.z = e
m.x = c
g.w = e
h.z = e
a.q = g
a.v = h
c.u = l
c.x = m
c.z = e
e.q = g
e.v = h
l.q = g
l.v = h
assert e.q.w.q.w.q.w.txt == "e"