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

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

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

b = A("b")
i = B("i")
k = C("k")
n = C("n")
c = C("c")
a = A("a")
l = B("l")
h = A("h")
j = C("j")

b.q = a
b.z = h
i.u = c
i.s = c
i.q = n
k.u = j
k.p = l
k.t = h
n.u = c
n.p = l
n.t = b
c.u = j
c.p = l
c.t = b
a.q = b
a.z = b
l.u = k
l.s = k
l.q = c
h.q = b
h.z = b
j.u = k
j.p = l
j.t = b
assert b.z.z.q.q.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: A = None
        self.txt = txt

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

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

b = A("b")
i = B("i")
k = C("k")
n = C("n")
c = C("c")
a = A("a")
l = B("l")
h = A("h")
j = C("j")

b.q = a
b.z = h
i.u = c
i.s = c
i.q = n
k.u = j
k.p = l
k.t = h
n.u = c
n.p = l
n.t = b
c.u = j
c.p = l
c.t = b
a.q = b
a.z = b
l.u = k
l.s = k
l.q = c
h.q = b
h.z = b
j.u = k
j.p = l
j.t = b
assert b.z.z.q.q.z.z.txt == "b"