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

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

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

b = A("b")
a = B("a")
g = C("g")
i = A("i")
c = B("c")
n = B("n")
m = C("m")
f = A("f")
e = A("e")
l = C("l")

b.q = m
b.z = m
b.t = e
a.t = f
g.p = i
g.z = c
i.q = m
i.z = l
i.t = f
c.t = f
n.t = b
m.p = f
m.z = c
f.q = l
f.z = m
f.t = b
e.q = l
e.z = m
e.t = f
l.p = e
l.z = a
assert m.p.q.p.q.p.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: C = None
        self.t: A = None
        self.txt = txt

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

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

b = A("b")
a = B("a")
g = C("g")
i = A("i")
c = B("c")
n = B("n")
m = C("m")
f = A("f")
e = A("e")
l = C("l")

b.q = m
b.z = m
b.t = e
a.t = f
g.p = i
g.z = c
i.q = m
i.z = l
i.t = f
c.t = f
n.t = b
m.p = f
m.z = c
f.q = l
f.z = m
f.t = b
e.q = l
e.z = m
e.t = f
l.p = e
l.z = a
assert m.p.q.p.q.p.t.q.txt == "l"