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

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

h = A("h")
m = B("m")
l = B("l")
f = B("f")
b = B("b")
e = B("e")
n = A("n")
i = A("i")
j = B("j")
c = B("c")

h.s = n
h.u = i
m.s = i
m.u = h
l.s = i
l.u = i
f.s = n
f.u = h
b.s = h
b.u = h
e.s = i
e.u = n
n.s = i
n.u = i
i.s = h
i.u = h
j.s = h
j.u = n
c.s = i
c.u = h
assert j.s.s.u.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.u: A = None
        self.txt = txt

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

h = A("h")
m = B("m")
l = B("l")
f = B("f")
b = B("b")
e = B("e")
n = A("n")
i = A("i")
j = B("j")
c = B("c")

h.s = n
h.u = i
m.s = i
m.u = h
l.s = i
l.u = i
f.s = n
f.u = h
b.s = h
b.u = h
e.s = i
e.u = n
n.s = i
n.u = i
i.s = h
i.u = h
j.s = h
j.u = n
c.s = i
c.u = h
assert j.s.s.u.s.s.s.s.txt == "h"