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

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

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

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

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

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

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

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

b.s = n
n.w = i
h.u = b
i.w = n
assert n.w.w.w.txt == "i"