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

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

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

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

e.v = k
e.y = k
e.t = d
d.w = k
c.u = d
c.x = d
k.v = e
k.y = e
k.t = d
assert k.v.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.t: B = None
        self.y: A = None
        self.txt = txt

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

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

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

e.v = k
e.y = k
e.t = d
d.w = k
c.u = d
c.x = d
k.v = e
k.y = e
k.t = d
assert k.v.t.w.txt == "k"