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

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

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

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

a.s = l
a.u = l
n.w = l
l.q = a
l.u = n
assert l.q.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: C = None
        self.txt = txt

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

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

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

a.s = l
a.u = l
n.w = l
l.q = a
l.u = n
assert l.q.u.u.txt == "n"