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

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

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

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

j = A("j")
i = B("i")
c = C("c")
l = D("l")

j.z = l
j.o = c
i.p = j
i.t = j
i.q = l
i.z = l
c.u = j
c.p = i
l.w = j
l.r = j
l.u = i
assert j.o.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: C = None
        self.txt = txt

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

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

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

j = A("j")
i = B("i")
c = C("c")
l = D("l")

j.z = l
j.o = c
i.p = j
i.t = j
i.q = l
i.z = l
c.u = j
c.p = i
l.w = j
l.r = j
l.u = i
assert j.o.p.z.txt == "l"