class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: C = 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.x: B = None
        self.o: C = None
        self.txt = txt

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

c.q = l
c.x = l
n.s = c
e.x = n
e.o = l
l.x = n
l.o = e
assert n.s.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: C = 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.x: B = None
        self.o: C = None
        self.txt = txt

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

c.q = l
c.x = l
n.s = c
e.x = n
e.o = l
l.x = n
l.o = e
assert n.s.x.o.txt == "e"