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

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

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

e = A("e")
d = B("d")
c = C("c")

e.t = c
e.p = c
e.v = c
d.s = c
c.v = d
c.y = d
c.s = e
assert d.s.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: C = None
        self.v: C = None
        self.txt = txt

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

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

e = A("e")
d = B("d")
c = C("c")

e.t = c
e.p = c
e.v = c
d.s = c
c.v = d
c.y = d
c.s = e
assert d.s.s.t.txt == "c"