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

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

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

f = A("f")
c = B("c")
i = C("i")
j = B("j")

f.w = i
f.t = c
c.s = f
c.v = j
i.z = c
i.p = f
i.y = f
j.s = f
j.v = c
assert f.t.v.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: B = None
        self.txt = txt

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

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

f = A("f")
c = B("c")
i = C("i")
j = B("j")

f.w = i
f.t = c
c.s = f
c.v = j
i.z = c
i.p = f
i.y = f
j.s = f
j.v = c
assert f.t.v.s.t.txt == "c"