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

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

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

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

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

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

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

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

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