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

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

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

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

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

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

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

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

f.z = l
f.s = l
f.p = e
e.z = l
e.v = l
l.s = e
l.y = e
assert f.s.y.v.txt == "l"