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

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

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

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

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

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

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

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

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