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

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

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

l = A("l")
a = B("a")
f = C("f")
h = A("h")

l.s = a
l.z = a
l.p = a
a.v = f
a.p = f
f.w = a
f.o = a
h.s = a
h.z = a
h.p = a
assert h.s.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: B = None
        self.p: B = None
        self.txt = txt

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

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

l = A("l")
a = B("a")
f = C("f")
h = A("h")

l.s = a
l.z = a
l.p = a
a.v = f
a.p = f
f.w = a
f.o = a
h.s = a
h.z = a
h.p = a
assert h.s.p.w.txt == "a"