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

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

e = A("e")
h = B("h")
m = B("m")
n = B("n")
a = A("a")
i = A("i")
j = A("j")
d = B("d")
b = B("b")
f = B("f")

e.u = j
e.s = m
h.z = m
h.y = i
m.z = n
m.y = e
n.z = m
n.y = e
a.u = j
a.s = n
i.u = e
i.s = h
j.u = a
j.s = d
d.z = m
d.y = j
b.z = h
b.y = a
f.z = m
f.y = a
assert h.z.z.y.u.s.z.z.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: B = None
        self.txt = txt

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

e = A("e")
h = B("h")
m = B("m")
n = B("n")
a = A("a")
i = A("i")
j = A("j")
d = B("d")
b = B("b")
f = B("f")

e.u = j
e.s = m
h.z = m
h.y = i
m.z = n
m.y = e
n.z = m
n.y = e
a.u = j
a.s = n
i.u = e
i.s = h
j.u = a
j.s = d
d.z = m
d.y = j
b.z = h
b.y = a
f.z = m
f.y = a
assert h.z.z.y.u.s.z.z.z.y.txt == "e"