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

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

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

e = A("e")
k = B("k")
d = C("d")

e.v = d
e.u = d
k.p = e
k.x = d
d.z = k
assert e.v.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: C = None
        self.txt = txt

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

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

e = A("e")
k = B("k")
d = C("d")

e.v = d
e.u = d
k.p = e
k.x = d
d.z = k
assert e.v.z.x.txt == "d"