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

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

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

j = A("j")
k = B("k")
i = C("i")
a = B("a")
b = A("b")

j.z = k
k.v = j
i.w = k
i.t = a
a.v = j
b.z = a
assert j.z.v.z.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

j = A("j")
k = B("k")
i = C("i")
a = B("a")
b = A("b")

j.z = k
k.v = j
i.w = k
i.t = a
a.v = j
b.z = a
assert j.z.v.z.v.z.txt == "k"