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

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

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

l = A("l")
c = B("c")
n = C("n")
k = A("k")
j = C("j")
g = C("g")
d = C("d")
m = B("m")

l.u = j
l.q = m
l.p = k
c.u = l
n.z = m
n.q = k
n.u = l
k.u = d
k.q = c
k.p = l
j.z = m
j.q = l
j.u = k
g.z = c
g.q = l
g.u = l
d.z = c
d.q = k
d.u = l
m.u = k
assert n.u.u.q.p.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.q: B = None
        self.p: A = None
        self.txt = txt

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

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

l = A("l")
c = B("c")
n = C("n")
k = A("k")
j = C("j")
g = C("g")
d = C("d")
m = B("m")

l.u = j
l.q = m
l.p = k
c.u = l
n.z = m
n.q = k
n.u = l
k.u = d
k.q = c
k.p = l
j.z = m
j.q = l
j.u = k
g.z = c
g.q = l
g.u = l
d.z = c
d.q = k
d.u = l
m.u = k
assert n.u.u.q.p.u.q.txt == "k"