class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

h = A("h")
l = B("l")
e = C("e")
b = D("b")
m = E("m")
n = D("n")
g = D("g")
k = D("k")
c = A("c")
j = D("j")

h.s = j
l.p = m
e.r = h
e.t = h
b.y = l
b.s = l
b.q = g
m.z = l
n.y = l
n.s = l
n.q = j
g.y = l
g.s = l
g.q = n
k.y = l
k.s = l
k.q = b
c.s = k
j.y = l
j.s = l
j.q = b
assert m.z.p.z.p.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

h = A("h")
l = B("l")
e = C("e")
b = D("b")
m = E("m")
n = D("n")
g = D("g")
k = D("k")
c = A("c")
j = D("j")

h.s = j
l.p = m
e.r = h
e.t = h
b.y = l
b.s = l
b.q = g
m.z = l
n.y = l
n.s = l
n.q = j
g.y = l
g.s = l
g.q = n
k.y = l
k.s = l
k.q = b
c.s = k
j.y = l
j.s = l
j.q = b
assert m.z.p.z.p.z.p.txt == "m"