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

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

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

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

e = A("e")
i = B("i")
l = C("l")
k = D("k")

e.r = l
i.s = k
i.o = e
l.z = e
k.y = l
k.z = e
k.u = e
k.t = i
assert e.r.z.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

e = A("e")
i = B("i")
l = C("l")
k = D("k")

e.r = l
i.s = k
i.o = e
l.z = e
k.y = l
k.z = e
k.u = e
k.t = i
assert e.r.z.r.txt == "l"