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

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

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

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

e.p = n
e.x = n
b.t = n
b.v = e
n.x = e
n.w = b
assert e.x.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: C = None
        self.txt = txt

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

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

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

e.p = n
e.x = n
b.t = n
b.v = e
n.x = e
n.w = b
assert e.x.w.v.txt == "e"