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.u: C = None
        self.o: C = None
        self.txt = txt

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

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

c.q = e
c.x = n
m.u = n
m.o = e
n.x = e
n.p = m
e.x = n
e.p = m
assert n.p.u.p.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.u: C = None
        self.o: C = None
        self.txt = txt

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

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

c.q = e
c.x = n
m.u = n
m.o = e
n.x = e
n.p = m
e.x = n
e.p = m
assert n.p.u.p.o.txt == "e"