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

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

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

e = A("e")
f = B("f")
d = C("d")
n = B("n")

e.v = d
e.w = n
f.t = n
f.z = e
d.p = e
d.o = n
n.t = f
n.z = e
assert d.p.v.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: B = None
        self.txt = txt

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

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

e = A("e")
f = B("f")
d = C("d")
n = B("n")

e.v = d
e.w = n
f.t = n
f.z = e
d.p = e
d.o = n
n.t = f
n.z = e
assert d.p.v.o.z.txt == "e"