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

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

h = A("h")
m = B("m")
i = A("i")
f = A("f")
a = A("a")
k = A("k")
l = A("l")
c = A("c")
b = B("b")
j = A("j")

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

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

h = A("h")
m = B("m")
i = A("i")
f = A("f")
a = A("a")
k = A("k")
l = A("l")
c = A("c")
b = B("b")
j = A("j")

h.t = b
h.s = f
m.u = i
i.t = b
i.s = k
f.t = m
f.s = c
a.t = b
a.s = h
k.t = b
k.s = c
l.t = b
l.s = k
c.t = b
c.s = f
b.u = a
j.t = m
j.s = a
assert b.u.s.s.s.t.u.s.t.txt == "b"