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

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

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

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

h.s = n
a.t = h
a.w = n
a.u = n
n.t = h
n.z = h
n.o = a
assert a.t.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

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

h.s = n
a.t = h
a.w = n
a.u = n
n.t = h
n.z = h
n.o = a
assert a.t.s.t.txt == "h"