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

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

e = A("e")
g = B("g")
i = B("i")
j = B("j")
f = B("f")
m = B("m")

e.o = j
g.u = f
i.u = j
j.u = m
f.u = m
m.u = i
assert f.u.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

e = A("e")
g = B("g")
i = B("i")
j = B("j")
f = B("f")
m = B("m")

e.o = j
g.u = f
i.u = j
j.u = m
f.u = m
m.u = i
assert f.u.u.u.u.u.u.txt == "j"