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

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

k = A("k")
b = B("b")
l = A("l")
c = A("c")
d = B("d")
g = A("g")
i = A("i")
m = B("m")
a = A("a")
j = B("j")

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

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

k = A("k")
b = B("b")
l = A("l")
c = A("c")
d = B("d")
g = A("g")
i = A("i")
m = B("m")
a = A("a")
j = B("j")

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