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

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

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

j = A("j")
g = B("g")
k = C("k")
f = B("f")

j.y = k
j.z = k
g.o = j
k.v = g
k.x = g
k.t = g
f.o = j
assert j.y.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: C = None
        self.txt = txt

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

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

j = A("j")
g = B("g")
k = C("k")
f = B("f")

j.y = k
j.z = k
g.o = j
k.v = g
k.x = g
k.t = g
f.o = j
assert j.y.t.o.txt == "j"