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

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

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

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

m = A("m")
j = B("j")
h = C("h")
a = D("a")
i = B("i")
k = B("k")
d = B("d")
n = A("n")
l = D("l")

m.s = h
m.q = h
m.z = n
m.y = n
j.r = m
h.x = m
h.u = a
a.z = m
a.s = m
a.u = m
a.w = m
i.r = m
k.r = n
d.r = m
n.s = h
n.q = h
n.z = m
n.y = m
l.z = n
l.w = n
l.s = m
l.u = m
assert h.x.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: C = None
        self.z: A = None
        self.y: A = None
        self.txt = txt

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

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

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

m = A("m")
j = B("j")
h = C("h")
a = D("a")
i = B("i")
k = B("k")
d = B("d")
n = A("n")
l = D("l")

m.s = h
m.q = h
m.z = n
m.y = n
j.r = m
h.x = m
h.u = a
a.z = m
a.s = m
a.u = m
a.w = m
i.r = m
k.r = n
d.r = m
n.s = h
n.q = h
n.z = m
n.y = m
l.z = n
l.w = n
l.s = m
l.u = m
assert h.x.q.u.txt == "a"