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

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

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

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

i.t = h
i.w = n
h.u = i
h.x = i
n.w = i
assert n.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: C = None
        self.txt = txt

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

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

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

i.t = h
i.w = n
h.u = i
h.x = i
n.w = i
assert n.w.w.w.txt == "i"