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

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

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

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

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

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

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

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

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