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

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

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

g = A("g")
k = B("k")
a = C("a")

g.y = k
g.z = a
k.s = g
a.o = k
a.x = k
assert a.o.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: C = None
        self.txt = txt

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

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

g = A("g")
k = B("k")
a = C("a")

g.y = k
g.z = a
k.s = g
a.o = k
a.x = k
assert a.o.s.z.txt == "a"