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

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

k = A("k")
h = B("h")
l = B("l")
a = B("a")
i = B("i")
j = B("j")
e = A("e")

k.x = i
h.s = k
l.s = k
a.s = k
i.s = e
j.s = k
e.x = i
assert k.x.s.x.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

k = A("k")
h = B("h")
l = B("l")
a = B("a")
i = B("i")
j = B("j")
e = A("e")

k.x = i
h.s = k
l.s = k
a.s = k
i.s = e
j.s = k
e.x = i
assert k.x.s.x.s.x.txt == "i"