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

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

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

l = A("l")
k = B("k")
c = C("c")
e = C("e")
i = B("i")
m = B("m")
j = C("j")

l.s = c
k.u = j
c.q = l
c.u = e
e.q = l
e.u = j
i.u = j
m.u = c
j.q = l
j.u = e
assert j.u.u.q.s.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

l = A("l")
k = B("k")
c = C("c")
e = C("e")
i = B("i")
m = B("m")
j = C("j")

l.s = c
k.u = j
c.q = l
c.u = e
e.q = l
e.u = j
i.u = j
m.u = c
j.q = l
j.u = e
assert j.u.u.q.s.q.s.txt == "c"