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

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

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

b = A("b")
n = B("n")
e = C("e")
l = B("l")

b.u = n
n.x = e
e.t = b
e.s = b
e.w = b
l.x = e
assert e.w.u.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

b = A("b")
n = B("n")
e = C("e")
l = B("l")

b.u = n
n.x = e
e.t = b
e.s = b
e.w = b
l.x = e
assert e.w.u.x.t.txt == "b"