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

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

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

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

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

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

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