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

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

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

j = A("j")
i = B("i")
a = C("a")
c = A("c")
l = A("l")
h = C("h")

j.z = a
j.v = l
i.o = c
i.y = h
a.z = l
c.z = a
c.v = j
l.z = a
l.v = j
h.z = j
assert h.z.v.v.v.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.v: A = None
        self.txt = txt

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

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

j = A("j")
i = B("i")
a = C("a")
c = A("c")
l = A("l")
h = C("h")

j.z = a
j.v = l
i.o = c
i.y = h
a.z = l
c.z = a
c.v = j
l.z = a
l.v = j
h.z = j
assert h.z.v.v.v.z.z.txt == "l"