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

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

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

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

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

m.z = e
h.x = g
h.s = g
h.u = e
h.q = l
g.x = h
g.q = m
g.r = e
e.q = l
e.w = g
e.u = m
l.q = e
l.w = g
l.u = m
j.x = g
j.s = g
j.u = l
j.q = l
c.x = g
c.s = g
c.u = l
c.q = e
assert e.u.z.q.u.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

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

m.z = e
h.x = g
h.s = g
h.u = e
h.q = l
g.x = h
g.q = m
g.r = e
e.q = l
e.w = g
e.u = m
l.q = e
l.w = g
l.u = m
j.x = g
j.s = g
j.u = l
j.q = l
c.x = g
c.s = g
c.u = l
c.q = e
assert e.u.z.q.u.z.u.txt == "m"