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

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

j = A("j")
m = B("m")
d = A("d")
b = A("b")
i = A("i")
g = B("g")
n = A("n")
f = A("f")
k = A("k")

j.u = g
j.x = f
m.o = n
m.s = g
d.u = m
d.x = n
b.u = m
b.x = i
i.u = m
i.x = b
g.o = b
g.s = m
n.u = g
n.x = b
f.u = m
f.x = d
k.u = g
k.x = f
assert m.o.x.u.o.x.u.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: A = None
        self.txt = txt

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

j = A("j")
m = B("m")
d = A("d")
b = A("b")
i = A("i")
g = B("g")
n = A("n")
f = A("f")
k = A("k")

j.u = g
j.x = f
m.o = n
m.s = g
d.u = m
d.x = n
b.u = m
b.x = i
i.u = m
i.x = b
g.o = b
g.s = m
n.u = g
n.x = b
f.u = m
f.x = d
k.u = g
k.x = f
assert m.o.x.u.o.x.u.s.s.txt == "m"