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

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

n = A("n")
f = B("f")
h = B("h")
l = B("l")
j = B("j")

n.u = l
n.t = j
f.u = h
f.s = h
h.u = j
h.s = l
l.u = f
l.s = h
j.u = f
j.s = l
assert l.s.u.s.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: B = None
        self.txt = txt

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

n = A("n")
f = B("f")
h = B("h")
l = B("l")
j = B("j")

n.u = l
n.t = j
f.u = h
f.s = h
h.u = j
h.s = l
l.u = f
l.s = h
j.u = f
j.s = l
assert l.s.u.s.u.s.txt == "h"