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

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

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

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

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

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

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

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

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

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

m.r = j
m.u = a
m.z = h
a.w = m
a.o = l
d.w = l
d.z = j
d.u = a
d.y = h
l.u = h
l.x = a
l.o = a
l.t = j
k.u = d
k.x = a
k.o = a
k.t = m
j.r = m
j.u = a
j.z = d
h.w = l
h.z = m
h.u = a
h.y = d
assert m.u.w.u.w.u.o.x.txt == "a"