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

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

h = A("h")
n = B("n")
m = B("m")
e = B("e")
d = B("d")
a = A("a")
c = B("c")

h.z = n
h.s = d
n.u = m
n.o = m
m.u = c
m.o = n
e.u = d
e.o = n
d.u = e
d.o = c
a.z = n
a.s = m
c.u = m
c.o = d
assert c.o.u.u.u.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: B = None
        self.txt = txt

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

h = A("h")
n = B("n")
m = B("m")
e = B("e")
d = B("d")
a = A("a")
c = B("c")

h.z = n
h.s = d
n.u = m
n.o = m
m.u = c
m.o = n
e.u = d
e.o = n
d.u = e
d.o = c
a.z = n
a.s = m
c.u = m
c.o = d
assert c.o.u.u.u.o.o.o.txt == "n"