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

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

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

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

m = A("m")
e = B("e")
j = C("j")
n = D("n")
l = C("l")
d = D("d")

m.z = l
e.z = l
j.v = n
j.r = n
j.o = l
n.w = m
n.v = e
n.x = d
l.v = d
l.r = d
l.o = j
d.w = m
d.v = e
d.x = n
assert n.x.w.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

m = A("m")
e = B("e")
j = C("j")
n = D("n")
l = C("l")
d = D("d")

m.z = l
e.z = l
j.v = n
j.r = n
j.o = l
n.w = m
n.v = e
n.x = d
l.v = d
l.r = d
l.o = j
d.w = m
d.v = e
d.x = n
assert n.x.w.z.v.txt == "d"