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

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

j = A("j")
n = B("n")
l = B("l")
i = A("i")
m = B("m")
h = B("h")

j.x = n
n.t = h
l.t = n
i.x = h
m.t = n
h.t = l
assert l.t.t.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

j = A("j")
n = B("n")
l = B("l")
i = A("i")
m = B("m")
h = B("h")

j.x = n
n.t = h
l.t = n
i.x = h
m.t = n
h.t = l
assert l.t.t.t.t.t.t.txt == "l"