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

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

k.q = b
k.z = l
k.s = j
c.u = b
d.p = c
d.s = m
b.q = k
b.z = d
b.s = j
n.u = k
m.u = b
j.p = g
j.s = m
l.p = g
l.s = c
g.u = k
assert n.u.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: C = None
        self.s: C = 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.p: B = None
        self.s: B = None
        self.txt = txt

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

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