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

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

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

b = A("b")
k = B("k")
d = C("d")
h = C("h")
g = B("g")
i = A("i")
c = A("c")
e = A("e")
a = C("a")
m = B("m")

b.p = m
b.z = a
b.q = h
k.x = b
k.t = g
k.z = a
d.s = h
d.q = m
h.s = d
h.q = g
g.x = c
g.t = m
g.z = a
i.p = g
i.z = a
i.q = a
c.p = k
c.z = h
c.q = h
e.p = g
e.z = d
e.q = d
a.s = d
a.q = m
m.x = c
m.t = g
m.z = a
assert i.p.z.s.s.s.q.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: C = None
        self.q: C = None
        self.txt = txt

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

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

b = A("b")
k = B("k")
d = C("d")
h = C("h")
g = B("g")
i = A("i")
c = A("c")
e = A("e")
a = C("a")
m = B("m")

b.p = m
b.z = a
b.q = h
k.x = b
k.t = g
k.z = a
d.s = h
d.q = m
h.s = d
h.q = g
g.x = c
g.t = m
g.z = a
i.p = g
i.z = a
i.q = a
c.p = k
c.z = h
c.q = h
e.p = g
e.z = d
e.q = d
a.s = d
a.q = m
m.x = c
m.t = g
m.z = a
assert i.p.z.s.s.s.q.x.q.txt == "h"