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

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

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

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

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

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

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

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

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

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

n.z = l
n.o = i
n.t = j
l.r = n
l.t = d
j.u = i
i.r = l
i.u = j
d.z = l
d.o = i
d.t = j
assert l.t.o.r.r.o.txt == "i"