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

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

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

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

k.x = j
j.s = k
j.w = a
a.z = k
a.w = j
assert j.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

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

k.x = j
j.s = k
j.w = a
a.z = k
a.w = j
assert j.w.w.w.txt == "a"