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

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

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

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

e.v = a
a.r = i
a.w = e
i.z = a
i.u = a
i.p = a
assert i.p.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

e.v = a
a.r = i
a.w = e
i.z = a
i.u = a
i.p = a
assert i.p.r.z.txt == "a"