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

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

l = A("l")
b = B("b")
n = A("n")
i = B("i")
g = A("g")
f = B("f")
h = B("h")

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

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

l = A("l")
b = B("b")
n = A("n")
i = B("i")
g = A("g")
f = B("f")
h = B("h")

l.x = h
l.u = f
b.s = h
b.o = i
n.x = h
n.u = f
i.s = b
i.o = h
g.x = f
g.u = i
f.s = h
f.o = b
h.s = b
h.o = b
assert i.o.s.o.s.o.txt == "i"