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

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

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

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

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

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

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

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

a.r = n
n.s = a
e.u = n
e.w = b
b.u = n
b.w = e
assert e.u.s.r.s.txt == "a"