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

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

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

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

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

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

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

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

l.z = i
e.t = l
e.p = i
i.s = l
i.y = l
assert l.z.s.z.txt == "i"