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

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

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

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

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

k.z = n
k.x = j
l.p = j
l.t = d
l.u = d
l.o = n
j.s = d
n.r = k
n.z = j
i.z = n
i.x = j
d.r = i
d.z = j
assert n.z.s.z.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: C = None
        self.txt = txt

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

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

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

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

k.z = n
k.x = j
l.p = j
l.t = d
l.u = d
l.o = n
j.s = d
n.r = k
n.z = j
i.z = n
i.x = j
d.r = i
d.z = j
assert n.z.s.z.s.z.txt == "j"