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

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

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

a = A("a")
d = B("d")
i = C("i")
e = C("e")

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

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

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

a = A("a")
d = B("d")
i = C("i")
e = C("e")

a.s = d
a.v = d
a.p = i
d.t = i
d.y = a
d.w = e
i.v = a
i.w = d
e.v = a
e.w = d
assert e.w.t.w.txt == "d"