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

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

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

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

e.u = d
e.r = d
e.t = d
c.p = n
c.q = n
f.x = n
f.s = d
f.u = m
d.x = m
d.s = f
d.u = n
m.p = n
m.q = n
n.p = c
n.q = c
assert c.p.p.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: C = None
        self.t: C = None
        self.txt = txt

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

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

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

e.u = d
e.r = d
e.t = d
c.p = n
c.q = n
f.x = n
f.s = d
f.u = m
d.x = m
d.s = f
d.u = n
m.p = n
m.q = n
n.p = c
n.q = c
assert c.p.p.q.q.q.txt == "n"