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

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

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

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

k.y = b
k.o = b
b.z = j
j.r = b
j.v = b
assert j.v.z.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: B = None
        self.txt = txt

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

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

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

k.y = b
k.o = b
b.z = j
j.r = b
j.v = b
assert j.v.z.r.txt == "b"