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

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

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

h = A("h")
i = B("i")
a = C("a")

h.x = a
h.z = a
h.y = i
i.u = a
i.x = a
i.q = h
a.o = h
a.w = i
assert h.x.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: B = None
        self.z: C = None
        self.txt = txt

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

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

h = A("h")
i = B("i")
a = C("a")

h.x = a
h.z = a
h.y = i
i.u = a
i.x = a
i.q = h
a.o = h
a.w = i
assert h.x.o.y.txt == "i"