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

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: C = None
        self.q: C = None
        self.txt = txt

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

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

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

i.z = l
i.v = l
l.o = i
l.y = j
l.q = j
j.z = i
j.v = l
e.r = j
n.r = j
assert j.z.v.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.v: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: C = None
        self.q: C = None
        self.txt = txt

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

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

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

i.z = l
i.v = l
l.o = i
l.y = j
l.q = j
j.z = i
j.v = l
e.r = j
n.r = j
assert j.z.v.o.v.txt == "l"