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

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

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

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

n = A("n")
m = B("m")
h = C("h")
c = D("c")
k = D("k")
e = B("e")
l = B("l")
a = B("a")
i = B("i")

n.z = h
n.x = c
m.o = n
h.r = n
c.u = n
c.r = k
c.z = k
c.w = h
k.u = n
k.r = c
k.z = c
k.w = h
e.o = n
l.o = n
a.o = n
i.o = n
assert c.z.w.r.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: D = None
        self.txt = txt

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

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

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

n = A("n")
m = B("m")
h = C("h")
c = D("c")
k = D("k")
e = B("e")
l = B("l")
a = B("a")
i = B("i")

n.z = h
n.x = c
m.o = n
h.r = n
c.u = n
c.r = k
c.z = k
c.w = h
k.u = n
k.r = c
k.z = c
k.w = h
e.o = n
l.o = n
a.o = n
i.o = n
assert c.z.w.r.x.r.txt == "k"